Commit b6c370b6
b6c370b69b72Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
ci: wrap cc with sccache + GitHub Actions cache backend
Adds mozilla-actions/[email protected] to each CI job and
wraps the compiler invocation as CC="sccache <cc>". sccache
uses GitHub Actions cache as its storage backend
(SCCACHE_GHA_ENABLED=true), so per-test .c → .o compiles hit
across runs.
Builds on PR #230 (test/bench rules already split into compile + link), which gives sccache the pure-compile invocation pattern it can cache. Without that split, sccache would have classified the combined compile+link calls as non-cacheable and skipped them.
Expected effect on warm cache: per-test cc time drops from
"compile + link" to "link only" (object files served from cache),
and the bootstrap cc gen1.c -o spinel_codegen also caches when
gen1.c hasn't changed. Windows mingw, the bottleneck job at
~388s build+test, should benefit most. Cold cache (first run, or
after a spinel_codegen.rb edit invalidates gen1.c) reverts to
current timing plus a small action overhead.
A few setup details:
- Each job ends with
sccache --show-statsso the hit/miss rate is visible in CI logs without enabling debug mode. We can use this to decide whether the integration is paying off after a week or two; if hit rate is consistently low the action can be reverted with no other effect on the pipeline. - For the Windows job,
setup-msys2is givenpath-type: inheritso the MSYS2 bash shell sees the Windows-side PATH wheresccache.exewas installed by sccache-action. Without this, make would invokesccacheand the shell wouldn't find it. - sccache-action runs after
setup-msys2on Windows so the inherited PATH ordering is correct; on POSIX jobs the order doesn't matter.
Cache scoping note: PRs read from the base branch (master) cache
read-only and write to their own scope. So a PR that touches
spinel_codegen.rb will miss on the bootstrap chain (gen1.c
changes) but hit on every test whose generated .c content is
unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- b6c370b69b72
- Parent
- 43d5c4b693d4
.github/workflows/ci.ymlmodifiedView file
- os: macos-latest cc: clang env: CC: ${{ matrix.cc }} # `sccache <cc>` wrapper. sccache forwards through to the # underlying compiler when its cache misses, so this stays # transparent. `SCCACHE_GHA_ENABLED=true` tells sccache to # use the GitHub Actions cache as its storage backend (set # up by the sccache-action step below). PR #230 split the # test/bench rules into separate compile and link steps so # the compile step is in sccache's cacheable pattern. CC: sccache ${{ matrix.cc }} SCCACHE_GHA_ENABLED: "true" steps: - uses: actions/checkout@v6 - name: Set up sccache uses: mozilla-actions/[email protected] - name: Set up Ruby uses: ruby/setup-ruby@v1 with: # -j$(...) overlaps the per-test cc invocations. run: make -j$(getconf _NPROCESSORS_ONLN) test OPT=-O0 - name: sccache stats if: always() run: sccache --show-stats windows-mingw: name: windows-mingw runs-on: windows-latest run: shell: msys2 {0} env: CC: gcc CC: sccache gcc SCCACHE_GHA_ENABLED: "true" steps: - uses: actions/checkout@v6 # Reuse the pacman package set across runs — saves ~1m of # download/install on every job. cache: true path-type: inherit install: >- base-devel mingw-w64-x86_64-toolchain curl tar # Install the sccache binary on the Windows-side PATH; MSYS2 # inherits Windows PATH (path-type: inherit, above) so the # `sccache` command resolves from the bash shell that make # invokes. - name: Set up sccache uses: mozilla-actions/[email protected] - name: Show toolchain run: | uname -a gcc --version ruby --version make --version | head -1 sccache --version - name: Fetch libprism sources run: make deps - name: Run tests run: make -j$(nproc) test OPT=-O0 - name: sccache stats if: always() run: sccache --show-stats