Replace graph evaluation with per-file Python values #2417
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: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/test.yml | |
| - crates/** | |
| - tests/** | |
| - Cargo.lock | |
| - Cargo.toml | |
| - pyproject.toml | |
| - noxfile.py | |
| - rust-toolchain.toml | |
| - uv.lock | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/test.yml | |
| - crates/** | |
| - tests/** | |
| - Cargo.lock | |
| - Cargo.toml | |
| - pyproject.toml | |
| - noxfile.py | |
| - rust-toolchain.toml | |
| - uv.lock | |
| workflow_call: | |
| inputs: | |
| os: | |
| description: Comma-delineated list of OS targets to run tests on | |
| required: false | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| os: | |
| description: Comma-delineated list of OS targets to run tests on | |
| required: false | |
| type: string | |
| concurrency: | |
| group: test-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| FORCE_COLOR: "1" | |
| PYTHONUNBUFFERED: "1" | |
| permissions: {} | |
| jobs: | |
| should-run: | |
| if: "${{ github.event_name != 'push' || startsWith(github.ref, 'refs/tags/') || !contains(github.event.head_commit.message, ':bookmark: bump version') }}" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: true | |
| generate-matrix: | |
| needs: [should-run] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| with: | |
| activate-environment: true | |
| enable-cache: true | |
| - name: Determine OS targets | |
| env: | |
| HEAD_REF: ${{ github.head_ref }} | |
| run: | | |
| if [[ "$HEAD_REF" == release/* ]]; then | |
| echo "OS=macos-latest,ubuntu-latest,windows-latest" >> $GITHUB_ENV | |
| fi | |
| - id: set-matrix | |
| env: | |
| OS: ${{ inputs.os }} | |
| run: | | |
| uv run --no-project --with "nox[uv]" nox --session gha_matrix -- "${OS}" | |
| test: | |
| name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| needs: generate-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Cache corpus | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: crates/djls-testing/.corpus | |
| key: ${{ runner.os }}-corpus-${{ hashFiles('crates/djls-testing/manifest.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-corpus- | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| with: | |
| activate-environment: true | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Run tests | |
| shell: bash | |
| env: | |
| DJANGO_VERSION: ${{ matrix.django-version }} | |
| PYTHON_VERSION: ${{ matrix.python-version }} | |
| run: | | |
| uv run --no-project --with "nox[uv]" nox --session "tests(python='${PYTHON_VERSION}', django='${DJANGO_VERSION}')" | |
| e2e: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| with: | |
| activate-environment: true | |
| enable-cache: true | |
| python-version: "3.10" | |
| - name: Run e2e tests | |
| shell: bash | |
| run: | | |
| uv run --no-project --with "nox[uv]" nox --session e2e | |
| tests: | |
| runs-on: ubuntu-latest | |
| needs: [test, e2e] | |
| if: always() | |
| steps: | |
| - name: OK | |
| if: ${{ !(contains(needs.*.result, 'failure')) }} | |
| run: exit 0 | |
| - name: Fail | |
| if: ${{ contains(needs.*.result, 'failure') }} | |
| run: exit 1 |