From 260b4d81fb38071000ebeddc1f7a5be8ed80af85 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 4 Mar 2025 18:39:02 -0500 Subject: [PATCH] run pytest on the pr build workflow --- .github/workflows/ci-build.yml | 37 ++++++++++++++++++++++++ .gitignore | 1 + sdk/python/src/.openapi-generator-ignore | 1 - sdk/python/src/.openapi-generator/FILES | 1 + sdk/python/src/__init__.py | 1 - sdk/python/src/requirements.txt | 4 +++ sdk/python/src/test-requirements.txt | 6 ++++ 7 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 sdk/python/src/requirements.txt create mode 100644 sdk/python/src/test-requirements.txt diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 07970c54..1bbe0061 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -88,6 +88,43 @@ jobs: path: ${{ steps.solve_go_bin.outputs.go_bin }}/zrok if-no-files-found: error + pytest: + + runs-on: ubuntu-24.04 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + shell: bash + working-directory: sdk/python/src/ + run: | + + set -o pipefail + set -o xtrace + + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r test-requirements.txt + + - name: Test with pytest + shell: bash + working-directory: sdk/python/src/ + run: | + + set -o pipefail + set -o xtrace + + pytest --cov=zrok_api + # build a release candidate container image for branches named "main" or like "v*" rc-container-build: needs: ubuntu-build diff --git a/.gitignore b/.gitignore index a8764d5b..8f53b79d 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ sdk/nodejs/sdk/dist # py module artifacts *.egg-info/ __pycache__/ +.coverage diff --git a/sdk/python/src/.openapi-generator-ignore b/sdk/python/src/.openapi-generator-ignore index 0038904a..db707341 100644 --- a/sdk/python/src/.openapi-generator-ignore +++ b/sdk/python/src/.openapi-generator-ignore @@ -8,7 +8,6 @@ git_push.sh pyproject.toml .github/workflows/python.yml tox.ini -test-requirements.txt # ## custom files that must not be overwritten diff --git a/sdk/python/src/.openapi-generator/FILES b/sdk/python/src/.openapi-generator/FILES index 6d1e98d7..5294bfba 100644 --- a/sdk/python/src/.openapi-generator/FILES +++ b/sdk/python/src/.openapi-generator/FILES @@ -57,6 +57,7 @@ docs/Verify200Response.md docs/VerifyRequest.md docs/VersionInventory200Response.md requirements.txt +test-requirements.txt test/__init__.py test/test_access201_response.py test/test_access_request.py diff --git a/sdk/python/src/__init__.py b/sdk/python/src/__init__.py index e6b36ad8..e69de29b 100644 --- a/sdk/python/src/__init__.py +++ b/sdk/python/src/__init__.py @@ -1 +0,0 @@ -from . import environment # noqa diff --git a/sdk/python/src/requirements.txt b/sdk/python/src/requirements.txt new file mode 100644 index 00000000..67f7f68d --- /dev/null +++ b/sdk/python/src/requirements.txt @@ -0,0 +1,4 @@ +urllib3 >= 1.25.3, < 3.0.0 +python_dateutil >= 2.8.2 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/sdk/python/src/test-requirements.txt b/sdk/python/src/test-requirements.txt new file mode 100644 index 00000000..e98555c1 --- /dev/null +++ b/sdk/python/src/test-requirements.txt @@ -0,0 +1,6 @@ +pytest >= 7.2.1 +pytest-cov >= 2.8.1 +tox >= 3.9.0 +flake8 >= 4.0.0 +types-python-dateutil >= 2.8.19.14 +mypy >= 1.5