feat(cli): build abi-agnostic wheels #1911
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: true | |
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-container | |
- test | |
- example | |
- format | |
- lint | |
- typecheck | |
- spelling | |
- pre-commit | |
steps: | |
- name: Failed | |
run: exit 1 | |
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, | |
'skipped') | |
test-container: | |
name: >- | |
Test Python ${{ matrix.python-version }} | |
on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
services: | |
broker: | |
image: pactfoundation/pact-broker:latest@sha256:0106b1f233b8869c865bbcf75bc158148222fad0a44423c4b6ac5f47df12167d | |
ports: | |
- 9292:9292 | |
env: | |
# Basic auth credentials for the Broker | |
PACT_BROKER_ALLOW_PUBLIC_READ: 'true' | |
PACT_BROKER_BASIC_AUTH_USERNAME: pactbroker | |
PACT_BROKER_BASIC_AUTH_PASSWORD: pactbroker | |
# Database | |
PACT_BROKER_DATABASE_URL: sqlite:////tmp/pact_broker.sqlite | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- '3.13' | |
experimental: | |
- false | |
include: | |
# Run tests against the next Python version, but no need for the full list of OSes. | |
- os: ubuntu-latest | |
python-version: '3.14' | |
experimental: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
with: | |
enable-cache: true | |
- name: Install Python | |
run: uv python install ${{ matrix.python-version }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Ensure broker is live | |
run: | | |
i=0 | |
until curl -sSf http://localhost:9292/diagnostic/status/heartbeat; do | |
i=$((i+1)) | |
if [ $i -gt 120 ]; then | |
echo "Broker failed to start" | |
exit 1 | |
fi | |
sleep 1 | |
done | |
- name: Run tests | |
run: hatch run test --broker-url=http://pactbroker:pactbroker@localhost:9292 --container | |
- name: Run tests (CLI) | |
working-directory: pact-python-cli | |
run: hatch run test | |
- name: Upload coverage | |
if: matrix.python-version == env.STABLE_PYTHON_VERSION && matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 | |
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 }} | |
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.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- '3.13' | |
# Python 3.9 aren't supported on macos-latest (ARM) | |
exclude: | |
- os: macos-latest | |
python-version: '3.9' | |
include: | |
- os: macos-13 | |
python-version: '3.9' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
with: | |
enable-cache: true | |
- name: Install Python | |
run: uv python install ${{ matrix.python-version }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Run tests | |
run: hatch run test | |
- name: Run tests (CLI) | |
working-directory: pact-python-cli | |
run: hatch run test | |
example: | |
name: Example | |
runs-on: ubuntu-latest | |
services: | |
broker: | |
image: pactfoundation/pact-broker:latest@sha256:0106b1f233b8869c865bbcf75bc158148222fad0a44423c4b6ac5f47df12167d | |
ports: | |
- 9292:9292 | |
env: | |
# Basic auth credentials for the Broker | |
PACT_BROKER_ALLOW_PUBLIC_READ: 'true' | |
PACT_BROKER_BASIC_AUTH_USERNAME: pactbroker | |
PACT_BROKER_BASIC_AUTH_PASSWORD: pactbroker | |
# Database | |
PACT_BROKER_DATABASE_URL: sqlite:////tmp/pact_broker.sqlite | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
with: | |
enable-cache: true | |
- name: Install Python | |
run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Ensure broker is live | |
run: | | |
i=0 | |
until curl -sSf http://localhost:9292/diagnostic/status/heartbeat; do | |
i=$((i+1)) | |
if [ $i -gt 120 ]; then | |
echo "Broker failed to start" | |
exit 1 | |
fi | |
sleep 1 | |
done | |
- name: Examples | |
run: > | |
hatch run example --broker-url=http://pactbroker:pactbroker@localhost:9292 | |
- name: Upload coverage | |
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
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 | |
- name: Format (CLI) | |
working-directory: pact-python-cli | |
run: hatch run format | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
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 lint | |
- name: Format (CLI) | |
working-directory: pact-python-cli | |
run: hatch run lint | |
typecheck: | |
name: Typecheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
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 | |
spelling: | |
name: Spell check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Spell Check Repo https://github.com/crate-ci/typos/commit/ | |
uses: crate-ci/typos@392b78fe18a52790c53f42456e46124f77346842 # v1.34.0 | |
pre-commit: | |
name: Pre-commit | |
runs-on: ubuntu-latest | |
env: | |
PRE_COMMIT_HOME: ${{ github.workspace }}/.pre-commit | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Cache pre-commit | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
with: | |
path: | | |
${{ env.PRE_COMMIT_HOME }} | |
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Set up uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
with: | |
enable-cache: true | |
cache-suffix: pre-commit | |
cache-dependency-glob: '' | |
- name: Install pre-commit | |
run: uv tool install pre-commit | |
- name: Run pre-commit | |
run: pre-commit run --show-diff-on-failure --color=always --all-files |