From 0783813fdfec255c2f66a0a700e7d883efed4739 Mon Sep 17 00:00:00 2001 From: Alison Shao <54658187+alisonshao@users.noreply.github.com> Date: Thu, 4 Jun 2026 01:25:00 -0700 Subject: [PATCH] ci: cache HF hub for base-a-test-cpu to avoid Hub 429 flakes (#27092) --- .github/workflows/pr-test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 18bed3548..1631aa39a 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -267,6 +267,8 @@ jobs: (needs.check-changes.outputs.main_package == 'true') runs-on: ubuntu-latest timeout-minutes: 240 + env: + HF_HOME: ${{ github.workspace }}/.hf-cache strategy: fail-fast: false max-parallel: ${{ fromJson(needs.check-changes.outputs.partitions)['base-a-test-cpu'].max_parallel }} @@ -316,6 +318,16 @@ jobs: run: | uv pip install -e "python[dev]" --index-strategy unsafe-best-match --prerelease allow + # Hosted runners are ephemeral, so models are re-fetched every run and the + # Hub occasionally returns 429s. Persist the HF cache in GitHub's cache + # storage (rolling key + restore-keys) so warm runs never hit the network. + - name: Cache HF hub + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/.hf-cache + key: hf-cpu-${{ matrix.partition }}-${{ github.run_id }} + restore-keys: hf-cpu-${{ matrix.partition }}- + - name: Run test timeout-minutes: 10 env: