Repository navigation
chore: render coverage numbers into the job summary #396
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: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| schedule: | |
| - cron: "15 1 * * 1" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| # ────────────────────────────────────────────── | |
| # Quality gates (run in parallel) | |
| # ────────────────────────────────────────────── | |
| test: | |
| if: github.event_name != 'schedule' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Setup dependencies | |
| run: make setup | |
| env: | |
| UV_PYTHON: ${{ matrix.python-version }} | |
| - name: Run tests | |
| run: make test-coverage | |
| env: | |
| UV_PYTHON: ${{ matrix.python-version }} | |
| # Shared with the other repos' coverage jobs. It lives in its own public | |
| # repo because a public repository -- this one -- cannot resolve an action | |
| # from a private one. An earlier attempt to consume it from the private | |
| # internal-workflows repo failed at `Set up job` on every matrix leg with | |
| # "Unable to resolve action, not found", so no tests ran at all. | |
| # | |
| # Pinned by commit rather than tag: a tag can be repointed at new code, | |
| # and pinning means a change to the action cannot reach us until we bump | |
| # it deliberately. | |
| - name: Coverage summary | |
| if: always() | |
| uses: runpod/coverage-summary-action@65b35a32ecfd9c2f0dc2352394eca1decfba4915 | |
| with: | |
| format: cobertura | |
| coverage-file: coverage.xml | |
| results: pytest-results.xml | |
| artifact-name: coverage-${{ matrix.python-version }} | |
| if-no-files-found: warn | |
| e2e: | |
| if: github.event_name != 'schedule' && github.repository == 'runpod/runpod-python' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: astral-sh/setup-uv@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install -e ".[test]" --quiet || uv pip install -e . | |
| uv pip install runpod-flash pytest pytest-asyncio pytest-timeout pytest-rerunfailures httpx | |
| uv pip install -e . --reinstall --no-deps | |
| python -c "import runpod; print(f'runpod: {runpod.__version__} from {runpod.__file__}')" | |
| - name: Run e2e tests | |
| run: | | |
| source .venv/bin/activate | |
| pytest tests/e2e/ -v -p no:xdist --timeout=600 --reruns 1 --reruns-delay 5 --log-cli-level=INFO -o "addopts=" | |
| env: | |
| RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }} | |
| RUNPOD_SDK_GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
| codeql: | |
| if: github.event_name == 'schedule' || github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v4.38.1 | |
| with: | |
| languages: python | |
| queries: security-extended,security-and-quality | |
| - name: Autobuild | |
| uses: github/codeql-action/autobuild@v4.38.1 | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v4.38.1 | |
| with: | |
| category: "/language:python" | |
| # ────────────────────────────────────────────── | |
| # Validation gate | |
| # ────────────────────────────────────────────── | |
| validation: | |
| runs-on: ubuntu-latest | |
| needs: [test, e2e, codeql] | |
| if: always() | |
| steps: | |
| - name: Check all jobs succeeded | |
| run: | | |
| results=("${{ needs.test.result }}" "${{ needs.e2e.result }}" "${{ needs.codeql.result }}") | |
| for result in "${results[@]}"; do | |
| if [[ "$result" != "success" && "$result" != "skipped" ]]; then | |
| echo "One or more quality checks failed (got: $result)" | |
| exit 1 | |
| fi | |
| done |