From 3c98570d3c622bd0982f7f8915366fbbbc70ca83 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 5 Apr 2024 10:51:03 -0600 Subject: [PATCH] Update hypothesis action to always save the cache (#8913) * Update hypothesis actions * fix path * try again * try again --- .github/workflows/hypothesis.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hypothesis.yaml b/.github/workflows/hypothesis.yaml index 62eb0800b2d..2772dac22b1 100644 --- a/.github/workflows/hypothesis.yaml +++ b/.github/workflows/hypothesis.yaml @@ -76,19 +76,33 @@ jobs: conda info -a conda list python xarray/util/print_versions.py + + # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache - name: Restore cached hypothesis directory - uses: actions/cache@v4 + id: restore-hypothesis-cache + uses: actions/cache/restore@v4 with: path: .hypothesis/ - key: cache-hypothesis - enableCrossOsArchive: true - save-always: true + key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }} + restore-keys: | + cache-hypothesis- + - name: Run slow Hypothesis tests if: success() id: status run: | python -m pytest --hypothesis-show-statistics --run-slow-hypothesis properties/*.py \ --report-log output-${{ matrix.python-version }}-log.jsonl + + # explicitly save the cache so it gets updated, also do this even if it fails. + - name: Save cached hypothesis directory + id: save-hypothesis-cache + if: always() && steps.status.outcome != 'skipped' + uses: actions/cache/save@v4 + with: + path: .hypothesis/ + key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }} + - name: Generate and publish the report if: | failure()