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: Next-Gen CI Pipeline | |
| on: | |
| pull_request: | |
| branches: [ main, preview ] | |
| # Native Merge Queue support for O(1) batching | |
| merge_group: | |
| types: [checks_requested] | |
| # Stop burning money on abandoned iterative commits | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ========================================== | |
| # 1. DISCOVERY ENGINE (The Router) | |
| # ========================================== | |
| discover: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| packages: ${{ steps.changes.outputs.all_changed_files }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect Changed Packages | |
| id: changes | |
| uses: tj-actions/changed-files@v44 | |
| with: | |
| files: packages/** | |
| dir_names: true | |
| dir_names_max_depth: 2 | |
| json: true | |
| escape_json: false | |
| # ========================================== | |
| # 2. STATIC ANALYSIS (Grouped for Speed) | |
| # ========================================== | |
| static-checks: | |
| needs: discover | |
| if: ${{ needs.discover.outputs.packages != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJSON(needs.discover.outputs.packages) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: "3.14" | |
| enable-cache: true | |
| cache-dependency-glob: "${{ matrix.package }}/setup.py" | |
| - name: Run Lint and MyPy | |
| run: | | |
| cd ${{ matrix.package }} | |
| export NOX_DEFAULT_VENV_BACKEND=uv | |
| # Chaining sessions executes them in a single fast VM | |
| uvx --with 'nox[uv]' nox -s lint mypy lint_setup_py | |
| # ========================================== | |
| # 3. DOCUMENTATION BUILD | |
| # ========================================== | |
| docs-build: | |
| needs: discover | |
| if: ${{ needs.discover.outputs.packages != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJSON(needs.discover.outputs.packages) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: "3.10" | |
| enable-cache: true | |
| cache-dependency-glob: "${{ matrix.package }}/setup.py" | |
| - name: Build Docs and DocFX | |
| run: | | |
| cd ${{ matrix.package }} | |
| export NOX_DEFAULT_VENV_BACKEND=uv | |
| uvx --with 'nox[uv]' nox -s docs docfx | |
| # ========================================== | |
| # 4. UNIT TESTS (The 2D Multiplier Matrix) | |
| # ========================================== | |
| unit-tests: | |
| needs: discover | |
| if: ${{ needs.discover.outputs.packages != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJSON(needs.discover.outputs.packages) }} | |
| python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| enable-cache: true | |
| cache-dependency-glob: "${{ matrix.package }}/setup.py" | |
| - name: Execute Unit Tests | |
| run: | | |
| cd ${{ matrix.package }} | |
| export NOX_DEFAULT_VENV_BACKEND=uv | |
| uvx --with 'nox[uv]' nox -s unit-${{ matrix.python }} | |
| # ========================================== | |
| # 5. SYSTEM TESTS | |
| # ========================================== | |
| system-tests: | |
| needs: discover | |
| if: ${{ needs.discover.outputs.packages != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJSON(needs.discover.outputs.packages) }} | |
| python: ["3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| enable-cache: true | |
| cache-dependency-glob: "${{ matrix.package }}/setup.py" | |
| - name: Execute System Tests | |
| env: | |
| RUN_SYSTEM_TESTS: "true" | |
| run: | | |
| cd ${{ matrix.package }} | |
| export NOX_DEFAULT_VENV_BACKEND=uv | |
| uvx --with 'nox[uv]' nox -s system | |
| # ========================================== | |
| # 6. THE GATEKEEPER (Status Check Rollup) | |
| # ========================================== | |
| presubmit-passed: | |
| # Always runs so GitHub can definitively mark the PR as passed/failed | |
| if: always() | |
| needs: | |
| - discover | |
| - static-checks | |
| - docs-build | |
| - unit-tests | |
| - system-tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Evaluate Pipeline Status | |
| run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then | |
| echo "::error::One or more required CI jobs failed or were cancelled." | |
| exit 1 | |
| fi | |
| # If the router output was empty, it means no Python code changed. | |
| if [[ "${{ needs.discover.outputs.packages }}" == "[]" ]]; then | |
| echo "No Python packages changed. Safely bypassing execution." | |
| exit 0 | |
| fi | |
| echo "All dynamically generated CI jobs completed successfully." |