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 Prototype | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| # 1. CONCURRENCY: Stop burning money on abandoned commits | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| 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/** # Only watch the packages directory | |
| dir_names: true # Return folder names, not files | |
| dir_names_max_depth: 2 # Strip it down to just "google-cloud-storage" | |
| json: true # Output a perfect JSON array for the matrix | |
| escape_json: false | |
| # 3. EXECUTION: Native Fan-out Matrix | |
| unit-test: | |
| needs: discover | |
| if: ${{ needs.discover.outputs.packages != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # Don't kill the whole matrix if one package fails | |
| matrix: | |
| package: ${{ fromJSON(needs.discover.outputs.packages) }} | |
| # Risk-Tiering: Smoke test on presubmit to save money | |
| python: ["3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # 4. THE ENGINE SWAP: Rust-based uv instead of setup-python + pip | |
| - name: Install uv and Python | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| enable-cache: true | |
| cache-dependency-glob: "packages/${{ matrix.package }}/setup.py" | |
| - name: Execute Tests (High-Density) | |
| run: | | |
| cd packages/${{ matrix.package }} | |
| # Force Nox to natively use uv instead of the legacy virtualenv module | |
| export NOX_DEFAULT_VENV_BACKEND=uv | |
| echo "Running targeted tests for ${{ matrix.package }} on Python ${{ matrix.python }}" | |
| # Use uvx to run nox (with the uv plugin injected to guarantee compatibility) | |
| uvx --with 'nox[uv]' nox -s unit-${{ matrix.python }} |