test: exercise managed providers without prewarming #994
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 Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.event_name == 'workflow_dispatch' && github.run_id || github.ref }} | |
| cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }} | |
| jobs: | |
| precheck: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Setup venv and install pip dependencies | |
| run: | | |
| uv venv --python "3.12" \ | |
| && uv sync --all-extras --all-groups --no-cache | |
| - name: Run pre-commit checks | |
| run: uv run prek run --all-files | |
| - name: Run documentation code blocks | |
| run: uv run pytest -vv --tb=long -m "not live_required" README.md django_example_project/README.md AGENTS.md skills docs | |
| live-documentation: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Setup venv and install pip dependencies | |
| run: | | |
| uv venv --python "3.12" | |
| uv sync --all-extras --all-groups --no-cache | |
| - name: Run live documentation code blocks | |
| run: uv run pytest -vv --tb=long -m live_required README.md django_example_project/README.md AGENTS.md skills docs | |
| discover-standard-tests: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| outputs: | |
| test-shards: ${{ steps.set-matrix.outputs.test-shards }} | |
| playwright-test: ${{ steps.set-matrix.outputs.playwright-test }} | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: false | |
| - name: Discover and shard standard test files | |
| id: set-matrix | |
| run: uv run --no-project python .github/ci_standard_test_shards.py >> "$GITHUB_OUTPUT" | |
| build: | |
| name: ${{ matrix.target.os_name }} py${{ matrix.target.python_version }} ${{ matrix.shard.name }} | |
| needs: discover-standard-tests | |
| runs-on: ${{ matrix.target.os }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 20 | |
| matrix: | |
| target: | |
| - os: ubuntu-24.04 | |
| os_name: linux | |
| python_version: '3.12.13' | |
| - os: ubuntu-24.04 | |
| os_name: linux | |
| python_version: '3.13.14' | |
| - os: ubuntu-24.04 | |
| os_name: linux | |
| python_version: '3.14.6' | |
| - os: macOS-15 | |
| os_name: macOS | |
| python_version: '3.12.10' | |
| - os: macOS-15 | |
| os_name: macOS | |
| python_version: '3.13.13' | |
| - os: macOS-15 | |
| os_name: macOS | |
| python_version: '3.14.6' | |
| shard: ${{ fromJson(needs.discover-standard-tests.outputs.test-shards) }} | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.target.python_version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Setup venv and install pip dependencies | |
| run: | | |
| uv venv --python "${{ matrix.target.python_version }}" | |
| uv sync --all-extras | |
| - name: Run standard test shard | |
| env: | |
| TEST_PATHS_JSON: ${{ toJson(matrix.shard.paths) }} | |
| run: | | |
| test_paths=() | |
| while IFS= read -r test_path; do | |
| [[ -z "$test_path" ]] || test_paths+=("$test_path") | |
| done < <(uv run --no-project python -c 'import json, os; print(*json.loads(os.environ["TEST_PATHS_JSON"]), sep="\n")') | |
| uv run pytest -vv --tb=long -m "not root_required and not docker_required" "${test_paths[@]}" | |
| playwright: | |
| name: ${{ matrix.target.os_name }} py${{ matrix.target.python_version }} playwrightprovider | |
| needs: discover-standard-tests | |
| runs-on: ${{ matrix.target.os }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 1 | |
| matrix: | |
| target: | |
| - os: ubuntu-24.04 | |
| os_name: linux | |
| python_version: '3.12.13' | |
| - os: ubuntu-24.04 | |
| os_name: linux | |
| python_version: '3.13.14' | |
| - os: ubuntu-24.04 | |
| os_name: linux | |
| python_version: '3.14.6' | |
| - os: macOS-15 | |
| os_name: macOS | |
| python_version: '3.12.10' | |
| - os: macOS-15 | |
| os_name: macOS | |
| python_version: '3.13.13' | |
| - os: macOS-15 | |
| os_name: macOS | |
| python_version: '3.14.6' | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.target.python_version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Setup venv and install pip dependencies | |
| run: | | |
| uv venv --python "${{ matrix.target.python_version }}" | |
| uv sync --all-extras | |
| - name: Run Playwright provider tests | |
| run: uv run pytest -vv --tb=long -m "not root_required and not docker_required" "${{ needs.discover-standard-tests.outputs.playwright-test }}" | |
| discover-live-tests: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| outputs: | |
| live-tests: ${{ steps.set-matrix.outputs.live-tests }} | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Discover live integration test files | |
| id: set-matrix | |
| run: | | |
| json_array="[" | |
| first=true | |
| for test_file in $(find tests -maxdepth 1 -name 'test_*.py' -type f | sort); do | |
| if ! grep -Eq '@pytest\.mark\.(root_required|docker_required)' "$test_file"; then | |
| continue | |
| fi | |
| test_name=$(basename "$test_file" .py | sed 's/^test_//') | |
| needs_docker=false | |
| if grep -q "@pytest.mark.docker_required" "$test_file"; then | |
| needs_docker=true | |
| fi | |
| os_targets="linux" | |
| for os_target in $os_targets; do | |
| if [ "$os_target" = "linux" ]; then | |
| os_json='"ubuntu-24.04"' | |
| else | |
| os_json='"macOS-15"' | |
| fi | |
| for python_version in 3.12.13 3.13.14 3.14.6; do | |
| entry="{\"name\":\"${test_name}-${os_target}\",\"path\":\"$test_file\",\"os\":${os_json},\"os_name\":\"${os_target}\",\"python_version\":\"${python_version}\",\"needs_docker\":$needs_docker}" | |
| if [ "$first" = true ]; then first=false; else json_array+=","; fi | |
| json_array+="$entry" | |
| done | |
| done | |
| done | |
| json_array+="]" | |
| if [ "$first" = true ]; then | |
| echo "No root_required or docker_required test files were discovered" >&2 | |
| exit 1 | |
| fi | |
| echo "live-tests=$json_array" >> "$GITHUB_OUTPUT" | |
| echo "$json_array" | |
| live-integration: | |
| name: ${{ matrix.live.name }} py${{ matrix.live.python_version }} | |
| needs: discover-live-tests | |
| runs-on: ${{ matrix.live.os }} | |
| timeout-minutes: 20 | |
| if: ${{ needs.discover-live-tests.outputs.live-tests != '[]' }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 20 | |
| matrix: | |
| live: ${{ fromJson(needs.discover-live-tests.outputs.live-tests) }} | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.live.python_version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Setup venv and install pip dependencies | |
| run: | | |
| uv venv --python "${{ matrix.live.python_version }}" | |
| uv sync --all-extras | |
| - name: Run every privileged provider test | |
| run: uv run pytest -vv --tb=long -m "root_required or docker_required" "${{ matrix.live.path }}" | |
| package: | |
| needs: | |
| - precheck | |
| - live-documentation | |
| - build | |
| - playwright | |
| - live-integration | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| version: "0.10.6" | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Build and validate distributions | |
| run: | | |
| uv build --out-dir dist | |
| uv publish --dry-run --trusted-publishing never dist/*.whl dist/*.tar.gz | |
| uv run --no-project python - <<'PY' > dist/SHA256SUMS | |
| from hashlib import sha256 | |
| from pathlib import Path | |
| dist = Path("dist") | |
| artifacts = sorted((*dist.glob("*.whl"), *dist.glob("*.tar.gz"))) | |
| if len(list(dist.glob("*.whl"))) != 1 or len(list(dist.glob("*.tar.gz"))) != 1: | |
| raise SystemExit(f"Expected one wheel and one sdist, found: {artifacts}") | |
| for artifact in artifacts: | |
| print(f"{sha256(artifact.read_bytes()).hexdigest()} {artifact.name}") | |
| PY | |
| - name: Upload tested distributions | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: abxpkg-dist-${{ github.sha }} | |
| path: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| dist/SHA256SUMS | |
| if-no-files-found: error | |
| retention-days: 90 |