Add pinact and zizmor workflow checks #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Checks | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| python: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Get Python Version | |
| id: get_python_version | |
| run: echo "::set-output name=python_version::$(python --version)" | |
| - name: Cache dependencies | |
| uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies | |
| - name: Install Poetry | |
| run: pip install poetry | |
| - name: Create Virtual Environment | |
| run: python -m venv .venv | |
| - name: Upgrade pip | |
| run: poetry run python -m pip install --upgrade pip | |
| - name: Install Dependencies | |
| run: poetry install | |
| - name: Run Black | |
| run: poetry run black . --check | |
| - name: Run isort | |
| run: poetry run isort . --check | |
| - name: Run safety | |
| run: poetry export -f requirements.txt | poetry run safety check --bare --stdin | |
| - name: Run mypy | |
| run: poetry run mypy --show-error-codes openapi_python_client | |
| - name: Run pylint | |
| run: poetry run pylint openapi_python_client | |
| - name: Run pytest | |
| run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp | |
| env: | |
| TASKIPY: true | |
| - name: Generate coverage report | |
| shell: bash | |
| run: poetry run coverage xml | |
| - uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 | |
| with: | |
| files: ./coverage.xml | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| openapi-test-server: | |
| image: ghcr.io/openapi-generators/openapi-test-server:0.0.1 | |
| ports: | |
| - "3000:3000" | |
| steps: | |
| - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1 | |
| with: | |
| python-version: "3.10" | |
| - name: Get Python Version | |
| id: get_python_version | |
| run: echo "::set-output name=python_version::$(python --version)" | |
| - name: Cache dependencies | |
| uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies | |
| - name: Install dependencies | |
| run: | | |
| pip install poetry | |
| python -m venv .venv | |
| poetry run python -m pip install --upgrade pip | |
| poetry install | |
| - name: Regenerate Integration Client | |
| run: | | |
| poetry run openapi-python-client update --url http://localhost:3000/openapi.json --config integration-tests-config.yaml | |
| - name: Check for any file changes | |
| run: python .github/check_for_changes.py | |
| - name: Cache Generated Client Dependencies | |
| uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0 | |
| with: | |
| path: integration-tests/.venv | |
| key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies | |
| - name: Install Integration Dependencies | |
| run: | | |
| cd integration-tests | |
| python -m venv .venv | |
| poetry run python -m pip install --upgrade pip | |
| poetry install | |
| - name: Run Tests | |
| run: | | |
| cd integration-tests | |
| poetry run pytest |