Jarek Potiuk 772f27d055 ci: verify committed dist/ matches a clean rebuild
Apache Infrastructure's verify-action-build tool (used to auto-review
Dependabot bumps of this action) flagged a drift in v0.0.10: the
committed dist/ matches only when rebuilt against the v0.0.9 lockfile,
not the v0.0.10 lockfile shipped alongside it. In practice this means
the release commit bumped package.json/package-lock.json version strings
but the dist/ was built earlier with the previous toolchain.

This is one of several ways to address that class of problem. The other
path is to simply rebuild dist/ and recommit for the current release;
that leaves the door open for it to happen again on the next release.

Adding this CI job is the preventive fix: it runs 'npm ci && npm run
build' on Node 24 (matching action.yml 'using: node24') and fails if
the committed dist/ differs from the rebuilt output. A release with a
stale dist/ will then be caught in CI rather than by downstream
consumers.

The existing build job keeps Node 18.x for format/lint/test; the new
job pins 24.x so the rebuild matches what the action actually runs on.
2026-07-29 12:54:27 +02:00
2026-04-23 00:18:33 +02:00
2025-10-23 10:57:48 +02:00
2023-01-10 12:41:30 +08:00
2023-01-11 11:21:31 +08:00
2023-01-10 12:39:09 +08:00
2026-03-12 11:04:18 +01:00
2023-01-09 15:53:06 +01:00
2026-04-23 00:18:33 +02:00

sccache-action

The sccache action can be used in GitHub Actions workflows to integrate sccache into the build process. The sccache action is a step in a workflow that can be used to cache compilation results for subsequent builds, reducing the build time and speeding up the overall development process.

sccache can easily use GitHub actions cache with almost no configuration.

This action is available on: https://github.com/marketplace/actions/sccache-action

Usage

Just copy and paste the following in your GitHub action:

Use the latest version of sccache if no version is specified

- name: Run sccache-cache
  uses: mozilla-actions/sccache-action@v0.0.10

Conditionally run cache and enable it

- name: Run sccache-cache only on non-release runs
  if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
  uses: mozilla-actions/sccache-action@v0.0.10
- name: Set Rust caching env vars only on non-release runs
  if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
  run: |
    echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
    echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV

Specify a given version of sccache

Versions prior to sccache v0.10.0 probably will not work.

- name: Run sccache-cache
  uses: mozilla-actions/sccache-action@v0.0.10
  with:
    version: "v0.10.0"

To get the execution stats

Note that using the previous declaration will automatically create a Post Run sccache-cache task.

- name: Run sccache stat for check
  shell: bash
  run: ${SCCACHE_PATH} --show-stats

disable stats report

- name: Run sccache-cache
  uses: mozilla-actions/sccache-action
  with:
    disable_annotations: true

Rust code

For Rust code, the following environment variables should be set:

    env:
      SCCACHE_GHA_ENABLED: "true"
      RUSTC_WRAPPER: "sccache"

C/C++ code

For C/C++ code, the following environment variables should be set:

    env:
      SCCACHE_GHA_ENABLED: "true"

With cmake, add the following argument:

-DCMAKE_C_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache

With configure, call it with:

# With gcc
./configure CC="sccache gcc" CXX="sccache gcc"
# With clang
./configure CC="sccache clang" CXX="sccache clang"

Using on GitHub Enterprise Server (GHES)

When using the action on GitHub Enterprise Server installations a valid GitHub.com token must be provided.

- name: Run sccache-cache
  uses: mozilla-actions/sccache-action@v0.0.10
  with:
    token: ${{ secrets.MY_GITHUB_TOKEN }}

Note that using https://github.com/actions/create-github-app-token is a better option than storing a fixed token in the repo secrets.

Prepare a new release

  1. Update the example in README.md
  2. Update version in package.json
  3. Run npm i --package-lock-only
  4. Run npm run build
  5. Commit and push the local changes
  6. Tag a new release (vX.X.X)
  7. Create a new release in github

License

Apache-2.0 (just like sccache)

S
Description
mirror of github.com/mozilla-actions/sccache-action
Readme Apache-2.0
3.4 MiB
Languages
TypeScript 100%