Skip to content

Commit

Permalink
Update dependencies and make tests more robust (GSI-707) (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Apr 23, 2024
1 parent a7e5011 commit ac4acb9
Show file tree
Hide file tree
Showing 87 changed files with 949 additions and 862 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/python-3-postgres
// Update the VARIANT arg in docker-compose.yml to pick a Python version: 3, 3.8, 3.7, 3.6
// Update the VARIANT arg in docker-compose.yml to pick a Python version: 3, 3.12, 3.11, 3.10, 3.9
{
"name": "${localWorkspaceFolderBasename}",
"dockerComposeFile": "docker-compose.yml",
Expand Down Expand Up @@ -75,4 +75,4 @@
// details can be found here: https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
}
}
}
2 changes: 1 addition & 1 deletion .devcontainer/license_header.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
for the German Human Genome-Phenome Archive (GHGA)

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/check_config_docs.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
name: Check if the config schema and the example are up to date.
name: Check if the config schema and the example are up to date

on: push

jobs:
static-code-analysis:
name: Check config schema and example

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- id: common
uses: ghga-de/gh-action-common@v4
- name: Common steps
id: common
uses: ghga-de/gh-action-common@v5
with:
python-version: '3.12'

- name: Check config docs
id: check-config-docs
run: |
export ${{ steps.common.outputs.CONFIG_YAML_ENV_VAR_NAME }}="${{ steps.common.outputs.CONFIG_YAML }}"
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/check_openapi_spec.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# This file is only needed, if your repository uses FastAPI
name: Check if openapi.yaml is up to date
# This file is only needed if your repository uses FastAPI
name: Check if OpenAPI spec is up to date

on: push

jobs:
static-code-analysis:
name: Check OpenAPI spec

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- id: common
uses: ghga-de/gh-action-common@v4
- name: Common steps
id: common
uses: ghga-de/gh-action-common@v5
with:
python-version: '3.12'

- name: Check if openapi.yaml is up to date
- name: Check openapi.yaml
id: check-openapi-docs
run: |
export ${{ steps.common.outputs.CONFIG_YAML_ENV_VAR_NAME }}="${{ steps.common.outputs.CONFIG_YAML }}"
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/check_pyproject.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
name: Check if the config schema and the example are up to date.
name: Check if pyproject.toml file is up to date

on: push

jobs:
static-code-analysis:
name: Check pyproject file

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- id: common
uses: ghga-de/gh-action-common@v4
- name: Common steps
id: common
uses: ghga-de/gh-action-common@v5
with:
python-version: '3.12'

- name: Check pyproject.toml
id: check-pyproject
run: |
./scripts/update_pyproject.py --check
19 changes: 14 additions & 5 deletions .github/workflows/check_readme.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
name: Check if the readme is up to date.
name: Check if the README file is up to date

on: push

jobs:
static-code-analysis:
name: Check README file

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- id: common
uses: ghga-de/gh-action-common@v4
- name: Common steps
id: common
uses: ghga-de/gh-action-common@v5
with:
python-version: '3.12'

- name: Check readme
- name: Check README
id: check-readme
run: |
./scripts/update_readme.py --check
17 changes: 13 additions & 4 deletions .github/workflows/check_template_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ on: push

jobs:
check-template-files:
name: Check template files

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: '3.12'

- name: Check template files
id: check-template-files
run: |
if [ "${{ github.event.repository.name }}" == "microservice-repository-template" ]
then
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ on:

jobs:
push_to_docker_hub:
name: Push to Docker Hub

runs-on: ubuntu-latest

steps:
- uses: ghga-de/gh-action-ci@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci_workflow_dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
fetch-tag:
name: Fetch Tag
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || ( github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'build') ) || ( github.event.action == 'labeled' && github.event.label.name == 'build' )
steps:
Expand All @@ -20,6 +21,7 @@ jobs:
latest_tag: ${{ steps.fetch-tag.outputs.latest_tag }}

push_to_docker_hub:
name: Push to Docker Hub
needs: fetch-tag
runs-on: ubuntu-latest
steps:
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@ on: push

jobs:
static-code-analysis:
runs-on: ubuntu-latest
name: Static Code Analysis

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- id: common
uses: ghga-de/gh-action-common@v4
- name: Common steps
id: common
uses: ghga-de/gh-action-common@v5

- uses: pre-commit/action@v3.0.0
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
env:
SKIP: no-commit-to-branch
- name: ruff

- name: Run ruff
id: ruff
run: |
ruff check --output-format=github .
ruff format --check .
- name: mypy
- name: Run mypy
id: mypy
run: |
mypy .
- name: Check license header and file
id: license-checker
run: |
./scripts/license_checker.py
21 changes: 13 additions & 8 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
name: Tests
name: Run test suite and measure coverage

on: push

jobs:
tests:
name: Run test suite

runs-on: ubuntu-latest
name: Tests

steps:
- uses: actions/checkout@v3
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- id: common
uses: ghga-de/gh-action-common@v4
- name: Common steps
id: common
uses: ghga-de/gh-action-common@v5

- id: pytest
- name: Run tests
id: pytest
run: |
export ${{ steps.common.outputs.CONFIG_YAML_ENV_VAR_NAME }}="${{ steps.common.outputs.CONFIG_YAML }}"
Expand All @@ -22,8 +27,8 @@ jobs:
--cov-report=xml \
tests
- id: coveralls
name: Upload coverage to coveralls
- name: Upload coverage to coveralls
id: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, dev, --branch, int, --branch, main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.4.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion .pyproject_generation/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
for the German Human Genome-Phenome Archive (GHGA)
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
10 changes: 5 additions & 5 deletions .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "wps"
version = "2.0.1"
version = "2.0.2"
description = "Work Package Service"
dependencies = [
"ghga-event-schemas~=3.1.0",
"ghga-service-commons[api,auth,crypt]>=3.1.1",
"hexkit[akafka,mongodb]>=2.1.1",
"httpx>=0.27.0",
"typer>=0.9.0",
"ghga-service-commons[api,auth,crypt]>=3.1.3",
"hexkit[akafka,mongodb]>=3.0.0",
"httpx>=0.27",
"typer>=0.12",
]

[project.urls]
Expand Down
14 changes: 8 additions & 6 deletions .pyproject_generation/pyproject_template.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=67.7.2"]
requires = ["setuptools>=69"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -15,6 +15,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Libraries",
Expand Down Expand Up @@ -43,8 +44,9 @@ fixable = [
"D", # pydocstyle
]
ignore = [
"E", # pycodestyle errors
"W", # pycodestyle warnings - pycodestyle covered by black
"E111", # indentation with invalid multiple (for formatter)
"E114", # indentation with invalid multiple comment (for formatter)
"E116", # over indentation (for formatter)
"PLW", # pylint warnings
"RUF001", # ambiguous unicode character strings
"RUF010", # explicit conversion to string or repr: !s or !r
Expand All @@ -56,8 +58,8 @@ ignore = [
"D400", # first doc line ends in period
"D401", # non-imperative-mood
"D107", # missing docstring in __init__
"D206", # indent-with-spaces (ignored for formatter)
"D300", # triple-single-quotes (ignored for formatter)
"D206", # indent-with-spaces (for formatter)
"D300", # triple-single-quotes (for formatter)
]
select = [
"C90", # McCabe Complexity
Expand Down Expand Up @@ -98,7 +100,7 @@ check_untyped_defs = true
no_site_packages = false

[tool.pytest.ini_options]
minversion = "7.1"
minversion = "8.0"
asyncio_mode = "strict"

[tool.coverage.paths]
Expand Down
2 changes: 1 addition & 1 deletion .readme_generation/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
for the German Human Genome-Phenome Archive (GHGA)
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion .template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
for the German Human Genome-Phenome Archive (GHGA)
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
# for the German Human Genome-Phenome Archive (GHGA)
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
for the German Human Genome-Phenome Archive (GHGA)

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading

0 comments on commit ac4acb9

Please sign in to comment.