7373 with :
7474 name : coverage
7575 path : coverage
76+ retention-days : 7
7677 if-no-files-found : error
7778
7879 node18-smoke :
@@ -177,36 +178,60 @@ jobs:
177178 with :
178179 node-version : ' 24.x'
179180 - run : bun install --frozen-lockfile
180- - name : Install the pinned real compiler
181+ - name : Cache the exact compiler package
182+ id : compiler-cache
183+ uses : actions/cache@v6
184+ with :
185+ path : ${{ runner.temp }}/hermes-tests/${{ matrix.directory }}
186+ # Full package version, not just HBC: .16 and .17 must never collide.
187+ key : hermesc-v1-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }}
188+ - name : Install and verify the pinned real compiler
181189 shell : bash
182190 env :
183191 COMPILER_PACKAGE : ${{ matrix.package }}
184192 COMPILER_DIRECTORY : ${{ matrix.directory }}
185193 COMPILER_EXECUTABLE : ${{ matrix.executable }}
186194 EXPECTED_HBC : ${{ matrix.hbc }}
195+ COMPILER_CACHE_HIT : ${{ steps.compiler-cache.outputs.cache-hit }}
187196 run : |
188197 set -euo pipefail
189198 root="$RUNNER_TEMP/hermes-tests/$COMPILER_DIRECTORY"
190- mkdir -p "$root"
191- archive=$(npm pack "$COMPILER_PACKAGE" --pack-destination "$RUNNER_TEMP" --silent)
192- tar -xzf "$RUNNER_TEMP/$archive" --strip-components=1 -C "$root" \
193- "package/$COMPILER_EXECUTABLE" package/package.json
199+ if [ "$COMPILER_CACHE_HIT" != true ]; then
200+ mkdir -p "$root"
201+ archive=$(npm pack "$COMPILER_PACKAGE" --pack-destination "$RUNNER_TEMP" --silent)
202+ tar -xzf "$RUNNER_TEMP/$archive" --strip-components=1 -C "$root" \
203+ "package/$COMPILER_EXECUTABLE" package/package.json
204+ fi
205+ # Cache hits still prove package identity, executable presence and HBC.
206+ node -e 'const p = require(process.argv[1]); if (`${p.name}@${p.version}` !== process.env.COMPILER_PACKAGE) throw new Error("unexpected compiler package");' "$root/package.json"
194207 export HERMESC="$root/$COMPILER_EXECUTABLE"
195208 test -x "$HERMESC"
196209 "$HERMESC" -version
197210 bun -e 'import {probeHbcVersion} from "./src/utils/hermes-base"; if (probeHbcVersion(process.env.HERMESC) !== Number(process.env.EXPECTED_HBC)) throw new Error("unexpected HBC version");'
198211 echo "HERMESC=$HERMESC" >> "$GITHUB_ENV"
199- - name : Fetch pinned real Metro fixtures
212+ - name : Cache pinned Metro fixtures
213+ id : metro-cache
214+ uses : actions/cache@v6
215+ with :
216+ path : ${{ runner.temp }}/hermes-metro-fixtures
217+ key : metro-fixtures-v1-${{ runner.os }}-e6a870a1c26c4b64c7860d7e1aa575707d22ad88
218+ - name : Fetch and verify pinned real Metro fixtures
200219 shell : bash
220+ env :
221+ METRO_CACHE_HIT : ${{ steps.metro-cache.outputs.cache-hit }}
201222 run : |
202223 set -euo pipefail
203224 root="$RUNNER_TEMP/hermes-metro-fixtures"
204225 mkdir -p "$root"
205226 base="https://raw.githubusercontent.com/sunnylqm/hbc-diff-benchmark/e6a870a1c26c4b64c7860d7e1aa575707d22ad88"
206- for file in base.jsbundle s3-medium-feature.jsbundle; do
207- curl --fail --location --retry 2 --max-time 60 "$base/fixtures/$file" -o "$root/$file"
208- done
209- curl --fail --location --retry 2 --max-time 60 "$base/LICENSE" -o "$root/LICENSE"
227+ if [ "$METRO_CACHE_HIT" != true ]; then
228+ for file in base.jsbundle s3-medium-feature.jsbundle; do
229+ curl --fail --location --retry 2 --max-time 60 "$base/fixtures/$file" -o "$root/$file"
230+ done
231+ curl --fail --location --retry 2 --max-time 60 "$base/LICENSE" -o "$root/LICENSE"
232+ fi
233+ test -s "$root/LICENSE"
234+ # Verification is unconditional, including on exact cache hits.
210235 echo "11c8ad8f7e8c7c59ee45582c77d896a35fa646617f3ba0f5b338a425a7c93b7d $root/base.jsbundle" | sha256sum --check
211236 echo "a693e68254b6c13fae8f839d20c14f9d11c5ab98d4be1b8d13ba1e929a12d752 $root/s3-medium-feature.jsbundle" | sha256sum --check
212237 echo "HERMES_METRO_FIXTURES=$root" >> "$GITHUB_ENV"
@@ -220,4 +245,5 @@ jobs:
220245 with :
221246 name : hermes-fuzz-hbc-${{ matrix.hbc }}${{ matrix.suffix }}
222247 path : ${{ runner.temp }}/hermes-fuzz
248+ retention-days : 7
223249 if-no-files-found : ignore
0 commit comments