fix: use safe filenames for test durations with underscores

This commit is contained in:
Greyson LaLonde
2025-09-10 16:25:52 -04:00
parent 711f33fbf7
commit 94d9287faa
2 changed files with 9 additions and 5 deletions

View File

@@ -48,16 +48,19 @@ jobs:
- name: Restore test durations
uses: actions/cache/restore@v4
with:
path: .test_durations_py${{ matrix.python-version }}
path: .test_durations_py*
key: test-durations-py${{ matrix.python-version }}-
restore-keys: |
test-durations-py${{ matrix.python-version }}-
- name: Run tests (group ${{ matrix.group }} of 8)
run: |
if [ -f .test_durations_py${{ matrix.python-version }} ]; then
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
DURATION_FILE=".test_durations_py${PYTHON_VERSION_SAFE}"
if [ -f "$DURATION_FILE" ]; then
echo "Using cached test durations for optimal splitting"
DURATIONS_ARG="--durations-path=.test_durations_py${{ matrix.python-version }}"
DURATIONS_ARG="--durations-path=${DURATION_FILE}"
else
echo "No cached durations found, tests will be split evenly"
DURATIONS_ARG=""

View File

@@ -49,14 +49,15 @@ jobs:
- name: Run all tests and store durations
run: |
uv run pytest --store-durations --durations-path=.test_durations_py${{ matrix.python-version }} -n auto
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
uv run pytest --store-durations --durations-path=.test_durations_py${PYTHON_VERSION_SAFE} -n auto
continue-on-error: true
- name: Save durations to cache
if: always()
uses: actions/cache/save@v4
with:
path: .test_durations_py${{ matrix.python-version }}
path: .test_durations_py*
key: test-durations-py${{ matrix.python-version }}-${{ github.sha }}
- name: Save uv caches