chore: fix argument to main test function #2593
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: test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| env: | |
| STABLE_PYTHON_VERSION: '3.13' | |
| PYTEST_ADDOPTS: --color=yes | |
| HATCH_VERBOSE: '1' | |
| FORCE_COLOR: '1' | |
| jobs: | |
| complete: | |
| name: Test completion check | |
| if: always() | |
| permissions: | |
| contents: none | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test | |
| - example | |
| - format | |
| - lint | |
| - typecheck | |
| - prek | |
| steps: | |
| - name: Failed | |
| run: exit 1 | |
| if: | | |
| contains(needs.*.result, 'failure') | |
| || contains(needs.*.result, 'cancelled') | |
| || contains(needs.*.result, 'skipped') | |
| test: | |
| name: >- | |
| Test Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, | |
| 'windows-') && 'Windows' || 'Linux' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-latest | |
| - ubuntu-latest | |
| - windows-latest | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| - '3.14' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| enable-cache: true | |
| - name: Install Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Set PATH on Windows | |
| if: startsWith(matrix.os, 'windows-') | |
| shell: pwsh | |
| run: echo "$pwd/pact-python-ffi/src/pact_ffi" >> $env:GITHUB_PATH | |
| - name: Set DYLD_LIBRARY_PATH on macOS | |
| if: startsWith(matrix.os, 'macos-') | |
| run: echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PWD/pact-python-ffi/src/pact_ffi" >> $GITHUB_ENV | |
| - name: Install Hatch | |
| run: uv tool install hatch | |
| - name: Run tests | |
| run: hatch run test.py${{ matrix.python-version }}:test --junit-xml=junit.xml | |
| - name: Run tests (v2) | |
| # Temporary workaround until Pydantic 3.12 is released with Python 3.14 support | |
| if: matrix.python-version != '3.14' | |
| run: hatch run v2-test.py${{ matrix.python-version }}:test --junit-xml=v2-junit.xml | |
| - name: Run tests (CLI) | |
| working-directory: pact-python-cli | |
| run: hatch run test.py${{ matrix.python-version }}:test --junit-xml=junit.xml | |
| - name: Run tests (FFI) | |
| working-directory: pact-python-ffi | |
| run: hatch run test.py${{ matrix.python-version }}:test --junit-xml=junit.xml | |
| - name: Upload coverage | |
| if: matrix.python-version == env.STABLE_PYTHON_VERSION && matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: tests | |
| - name: Upload test results | |
| if: ${{ !cancelled() }} | |
| uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| example: | |
| name: >- | |
| Test Python Example ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' | |
| || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-latest | |
| - ubuntu-latest | |
| - windows-latest | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| # Temporarily excluded until Pydantic 3.12 is released with Python | |
| # 3.14 support | |
| # - '3.14' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| enable-cache: true | |
| - name: Install Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Run examples | |
| shell: bash | |
| run: | | |
| set -o errexit | |
| set -o pipefail | |
| while IFS= read -r -d $'\0' file <&3; do | |
| cd "$(dirname "$file")" | |
| uv run --python ${{ matrix.python-version }} --group test pytest --junit-xml=junit.xml | |
| done 3< <(find "$(pwd)/examples" -name pyproject.toml -print0) | |
| - name: Upload coverage | |
| if: matrix.python-version == env.STABLE_PYTHON_VERSION && matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: examples | |
| - name: Upload test results | |
| if: ${{ !cancelled() }} | |
| uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| format: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| enable-cache: true | |
| - name: Install Python | |
| run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
| - name: Install Hatch | |
| run: uv tool install hatch | |
| - name: Format | |
| run: hatch run format --check --output-format github | |
| - name: Format (CLI) | |
| working-directory: pact-python-cli | |
| run: hatch run format --check --output-format github | |
| - name: Format (FFI) | |
| working-directory: pact-python-ffi | |
| run: hatch run format --check --output-format github | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| enable-cache: true | |
| - name: Install Python | |
| run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
| - name: Install Hatch | |
| run: uv tool install hatch | |
| - name: Lint | |
| run: hatch run lint | |
| - name: Lint (CLI) | |
| working-directory: pact-python-cli | |
| run: hatch run lint | |
| - name: Lint (FFI) | |
| working-directory: pact-python-ffi | |
| run: hatch run lint | |
| typecheck: | |
| name: Typecheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| enable-cache: true | |
| - name: Install Python | |
| run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
| - name: Install Hatch | |
| run: uv tool install hatch | |
| - name: Typecheck | |
| run: hatch run typecheck | |
| - name: Typecheck (CLI) | |
| working-directory: pact-python-cli | |
| run: hatch run typecheck | |
| prek: | |
| name: Prek (pre-commit) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Cache prek | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: |- | |
| ~/.cache/prek | |
| key: >- | |
| ${{ runner.os }}-prek-${{ | |
| hashFiles( | |
| '**/.pre-commit-config.yaml', | |
| '**/.pre-commit-config.yml' | |
| ) }} | |
| restore-keys: |- | |
| ${{ runner.os }}-prek- | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| enable-cache: true | |
| cache-suffix: prek | |
| cache-dependency-glob: |- | |
| **/.pre-commit-config.yaml | |
| **/.pre-commit-config.yml | |
| - name: Install prek | |
| run: uv tool install prek | |
| - name: Install hatch | |
| run: uv tool install hatch | |
| - name: Run prek | |
| run: prek run --show-diff-on-failure --color=always --all-files |