Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Build acceleration via sccache.
#
# `rustc-wrapper` routes every rustc invocation through sccache's shared compile
# cache, so clean builds and branch switches reuse previously-compiled artifacts
# (the pinned oxc / ruff git dependencies dominate build time and cache well).
#
# Requires `sccache` on PATH:
# cargo install sccache --locked # or: brew install sccache
#
# CI provisions it via mozilla-actions/sccache-action. If you do not have
# sccache installed, either install it (one command above) or override locally
# with `CARGO_BUILD_RUSTC_WRAPPER=""` / `RUSTC_WRAPPER=""`.
[build]
rustc-wrapper = "sccache"
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ permissions:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# sccache: .cargo/config.toml sets rustc-wrapper = "sccache", so every
# compiling job must have sccache on PATH. The action below installs it and
# these vars point it at the GitHub Actions cache backend. Incremental
# compilation is disabled because sccache cannot cache incremental units.
SCCACHE_GHA_ENABLED: "true"
CARGO_INCREMENTAL: 0

jobs:
fmt:
Expand All @@ -29,6 +35,7 @@ jobs:
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- uses: mozilla-actions/sccache-action@v0.0.9
- run: cargo fmt --all --check

clippy:
Expand All @@ -45,6 +52,7 @@ jobs:
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: mozilla-actions/sccache-action@v0.0.9
- run: cargo clippy --workspace --exclude conformance --all-targets -- -D warnings

test:
Expand All @@ -59,6 +67,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: mozilla-actions/sccache-action@v0.0.9
- run: cargo test --workspace --exclude conformance

deny:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ jobs:
needs: [meta, create_release]
if: needs.meta.outputs.release_assets_exist != 'true'
runs-on: ${{ matrix.os }}
# .cargo/config.toml sets rustc-wrapper = "sccache"; native builds get
# sccache from the action below. The Alpine container build neutralizes the
# wrapper instead (see that step), since rust:alpine has no sccache.
env:
SCCACHE_GHA_ENABLED: "true"
CARGO_INCREMENTAL: 0
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -230,6 +236,10 @@ jobs:
with:
key: ${{ matrix.triple }}

- name: Setup sccache
if: ${{ !matrix.alpine }}
uses: mozilla-actions/sccache-action@v0.0.9

# ruby-prism-sys runs bindgen at build time and needs libclang + libc
# headers; native Linux runners get them from apt.
- name: Install clang for bindgen (Linux)
Expand All @@ -256,9 +266,13 @@ jobs:
# dynamically linked (-crt-static off) to dlopen libclang. Building
# host-native applies the flag everywhere. Then place the binary at the
# triple path the shared packaging step expects.
# RUSTC_WRAPPER="" disables the sccache wrapper that .cargo/config.toml
# sets repo-wide; rust:alpine has no sccache, and the env var overrides
# the config value.
docker run --rm -v "$PWD":/work -w /work \
-e CARGO_TARGET_DIR=/work/target \
-e LIBCLANG_PATH=/usr/lib \
-e RUSTC_WRAPPER="" \
-e RUSTFLAGS="-C target-feature=-crt-static" \
rust:alpine sh -c '
set -e
Expand Down
Loading