From 94d9287faaef2b43546f49605b0ce3f1999ea737 Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Wed, 10 Sep 2025 16:25:52 -0400 Subject: [PATCH] fix: use safe filenames for test durations with underscores --- .github/workflows/tests.yml | 9 ++++++--- .github/workflows/update-test-durations.yml | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 08ba3bbd7..0f4c1ae31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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="" diff --git a/.github/workflows/update-test-durations.yml b/.github/workflows/update-test-durations.yml index 5f12a648a..daa1decfd 100644 --- a/.github/workflows/update-test-durations.yml +++ b/.github/workflows/update-test-durations.yml @@ -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