diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e6c37c1f..5b42465e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,14 +57,25 @@ jobs: - name: Install required Python packages run: | - python -m pip install --upgrade pip - python -m pip install -e .[dev-noxfile] + python -m pip install --upgrade pip uv + python -m uv pip install -e .[dev-noxfile] pip freeze + # Restore pytest cache only for pytest_min session to use the cache + - name: Restore pytest cache + if: ${{ matrix.nox-session == 'pytest_min' }} + uses: actions/cache/restore@v4 + id: restore-pytest-cache + with: + path: .pytest_cache + key: ${{ runner.os }}-pytest-cache-${{ matrix.os }}-${{ matrix.python }}-${{ github.ref_name }}-no-cache + restore-keys: | + ${{ runner.os }}-pytest-cache-${{ matrix.os }}-${{ matrix.python }}-${{ github.ref_name }}- + - name: Create nox venv env: NOX_SESSION: ${{ matrix.nox-session }} - run: nox --install-only -e "$NOX_SESSION" + run: nox -db uv --install-only -e "$NOX_SESSION" - name: Print pip freeze for nox venv (debug) env: @@ -74,12 +85,26 @@ jobs: pip freeze deactivate + # Run nox session - name: Run nox env: NOX_SESSION: ${{ matrix.nox-session }} - run: nox -R -e "$NOX_SESSION" + run: | + if [ "$NOX_SESSION" = "pytest_min" ]; then + nox -db uv -R -e "$NOX_SESSION" -- --ff -o cache_dir=.pytest_cache + else + nox -db uv -R -e "$NOX_SESSION" + fi timeout-minutes: 10 + # Save pytest cache only for pytest_min session + - name: Save pytest cache + if: always() && matrix.nox-session == 'pytest_min' + uses: actions/cache/save@v4 + with: + path: .pytest_cache + key: ${{ runner.os }}-pytest-cache-${{ matrix.os }}-${{ matrix.python }}-${{ github.ref_name }}-${{ github.run_number }} + # This job runs if all the `nox` matrix jobs ran and succeeded. # It is only used to have a single job that we can require in branch # protection rules, so we don't have to update the protection rules each time