From 072dfd5d3b9ac633c8a8191666b361de77bc2346 Mon Sep 17 00:00:00 2001 From: Tienson_Qin Date: Tue, 13 Oct 2026 06:30:49 +0800 Subject: [PATCH] ci: warm the OCaml env cache on base branches (never cancelled) --- .github/workflows/warm-cache.yml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/warm-cache.yml diff --git a/.github/workflows/warm-cache.yml b/.github/workflows/warm-cache.yml new file mode 100644 index 00000000..cb41406b --- /dev/null +++ b/.github/workflows/warm-cache.yml @@ -0,0 +1,41 @@ +name: Warm OCaml cache + +# PR runs can only restore caches saved on their own ref or on the base +# branch. CI's push runs on feat/ml-backend are cancel-in-progress and are +# routinely cancelled before the ~20 min cold Windows opam/cygwin setup +# saves, so no base-branch cache existed and every PR paid the cold +# setup (and raced to save a PR-scoped copy nobody else can read). +# This workflow is never cancelled: it only builds and saves the +# environment on the base branches, and refreshes it when the weekly +# epoch in the cache key rolls over. +on: + push: + branches: [main, feat/ml-backend] + paths: + - '*.opam' + - '*.opam.locked' + - 'dune-project' + - '.github/actions/setup-lui-ocaml/**' + - '.github/workflows/warm-cache.yml' + schedule: + # Monday 00:10 UTC: just after the ISO week (cache epoch) rolls. + - cron: '10 0 * * 1' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: warm-cache-${{ github.ref }} + cancel-in-progress: false + +jobs: + warm: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-lui-ocaml