ソースを参照

Change cache handling

Efren Yevale Varela 3 週間 前
親
コミット
81769a4f70
3 ファイル変更、66 行追加、5 行削除
  1. 1 0
      .dockerignore
  2. 64 5
      .github/workflows/ci.yml
  3. 1 0
      .gitignore

+ 1 - 0
.dockerignore

@@ -20,6 +20,7 @@ fuzz/build/
 fuzz/artifacts/
 scripts/__pycache__/
 target/
+.sccache/
 # NOTE: `build.sh` MUST stay in the context: `.clusterfuzzlite/Dockerfile`
 # copies it (`COPY .clusterfuzzlite/build.sh`) from this same context.
 .clusterfuzzlite/*

+ 64 - 5
.github/workflows/ci.yml

@@ -42,11 +42,14 @@ permissions:
 env:
   CARGO_TERM_COLOR: always
   SQLX_OFFLINE: "true"
-  # Shared compilation cache (each compiling job below starts it via
-  # sccache-action, except `miri`: cargo-miri overrides RUSTC_WRAPPER
-  # itself). Incremental is useless on ephemeral runners, and disabling it
-  # maximizes cache hits.
-  SCCACHE_GHA_ENABLED: "true"
+  # Shared compilation cache: sccache runs in each compiling job below (except
+  # `miri`, whose cargo-miri overrides RUSTC_WRAPPER itself). It writes to a
+  # local on-disk dir (SCCACHE_DIR) persisted by actions/cache -- NOT the GitHub
+  # Actions cache backend, which stores one cache entry per compiled object
+  # (thousands per run, per-ref duplicated); SCCACHE_GHA_ENABLED is deliberately
+  # left unset. Incremental is useless on ephemeral runners and harms cross-run
+  # cache hits.
+  SCCACHE_DIR: ${{ github.workspace }}/.sccache
   CARGO_INCREMENTAL: "0"
 
 jobs:
@@ -71,6 +74,13 @@ jobs:
       - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
         with:
           components: clippy
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -126,6 +136,13 @@ jobs:
     steps:
       - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
       - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -162,6 +179,13 @@ jobs:
     steps:
       - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
       - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -188,6 +212,13 @@ jobs:
     steps:
       - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
       - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -211,6 +242,13 @@ jobs:
         uses: taiki-e/install-action@ab6895351a88b908e96a4697860d4ffea5e57dbe # v2
         with:
           tool: cargo-fuzz
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -248,6 +286,13 @@ jobs:
         uses: taiki-e/install-action@ab6895351a88b908e96a4697860d4ffea5e57dbe # v2
         with:
           tool: cargo-fuzz
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -292,6 +337,13 @@ jobs:
     steps:
       - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
       - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:
@@ -320,6 +372,13 @@ jobs:
       - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable
         with:
           components: llvm-tools-preview
+      - name: Cache sccache directory
+        uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
+        with:
+          path: ${{ env.SCCACHE_DIR }}
+          key: sccache-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'fuzz/Cargo.lock') }}
+          restore-keys: |
+            sccache-${{ runner.os }}-
       - name: Start sccache (shared compilation cache)
         uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
         with:

+ 1 - 0
.gitignore

@@ -4,6 +4,7 @@
 .omo/
 .opencode/
 /target
+.sccache/
 __pycache__/
 scripts/__pycache__/
 lcov.info