Skip to content

Commit 16cfff0

Browse files
committed
CI: Run previously failed tests first
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent cf54baa commit 16cfff0

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ jobs:
6161
python -m pip install -e .[dev-noxfile]
6262
pip freeze
6363
64+
# Restore pytest cache only for pytest_min session to use the cache
65+
- name: Restore pytest cache
66+
if: ${{ matrix.nox-session == 'pytest_min' }}
67+
uses: actions/cache/restore@v4
68+
id: restore-pytest-cache
69+
with:
70+
path: .pytest_cache
71+
key: ${{ runner.os }}-pytest-cache-${{ matrix.os }}-${{ matrix.python }}-${{ github.ref_name }}-v4
72+
6473
- name: Create nox venv
6574
env:
6675
NOX_SESSION: ${{ matrix.nox-session }}
@@ -74,12 +83,26 @@ jobs:
7483
pip freeze
7584
deactivate
7685
86+
# Run nox session
7787
- name: Run nox
7888
env:
7989
NOX_SESSION: ${{ matrix.nox-session }}
80-
run: nox -R -e "$NOX_SESSION"
90+
run: |
91+
if [ "$NOX_SESSION" = "pytest_min" ]; then
92+
nox -R -e "$NOX_SESSION" -- --ff -o cache_dir=.pytest_cache
93+
else
94+
nox -R -e "$NOX_SESSION"
95+
fi
8196
timeout-minutes: 10
8297

98+
# Save pytest cache only for pytest_min session
99+
- name: Save pytest cache
100+
if: always() && matrix.nox-session == 'pytest_min' && steps.restore-pytest-cache.outputs.cache-hit != 'true'
101+
uses: actions/cache/save@v4
102+
with:
103+
path: .pytest_cache
104+
key: ${{ runner.os }}-pytest-cache-${{ matrix.os }}-${{ matrix.python }}-${{ github.ref_name }}-v4
105+
83106
# This job runs if all the `nox` matrix jobs ran and succeeded.
84107
# It is only used to have a single job that we can require in branch
85108
# protection rules, so we don't have to update the protection rules each time

0 commit comments

Comments
 (0)