Skip to content

CI

CI #5167

Workflow file for this run

name: CI
on:
push:
branches: [trunk]
pull_request:
branches: [trunk]
merge_group:
branches: [trunk]
# Cancel in-progress runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install dotslash
uses: facebook/install-dotslash@v2 # pinned: the moving `latest` branch broke macOS runners (sha256sum flags) on 2026-06-18
- name: Check formatting
# Buck declares all Rust sources as inputs and applies the hermetic
# rustfmt target's platform-specific runtime environment.
run: ./buck2 test //:fmt-check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install dotslash
uses: facebook/install-dotslash@v2 # pinned: the moving `latest` branch broke macOS runners (sha256sum flags) on 2026-06-18
# Cache the dotslash-downloaded buck2 binary (see the `test` job for the
# rationale on which paths are worth caching).
- name: Cache dotslash artifacts
uses: actions/cache@v5
with:
path: |
~/.cache/dotslash
~/Library/Caches/dotslash
key: dotslash-linux-x64-${{ hashFiles('buck2') }}
restore-keys: |
dotslash-linux-x64-
- name: Run clippy
# Builds the [clippy.txt] subtarget for every first-party crate and
# fails on any clippy error. Workspace lint policy (deny warnings +
# grandfathered allow-list) lives in toolchains/rust/BUCK.
run: ./clippy.sh
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Lint GitHub Actions workflows
# A workflow file GitHub can't parse fails every run in 0s with no
# useful error, and nothing in ./test.sh can see it — benchmarks.yml
# was broken this way for five months (gh-991). actionlint also
# shellchecks all run: blocks.
run: docker run --rm -v "$PWD:/repo" -w /repo rhysd/actionlint:latest -color
rust-project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Validate rust-project.json
# Rue has no Cargo workspace, so rust-project.json is THE rust-analyzer
# model. It drifted silently before (referenced a deleted crate, omitted
# live ones), misdirecting anyone opening the repo in an IDE (RUE-516).
# Pure-filesystem check, no Buck needed; regenerate with
# ./gen-rust-project.sh when it complains.
run: python3 scripts/validate-rust-project.py
test:
strategy:
matrix:
include:
- os: ubuntu-latest
name: linux-x64
- os: ubuntu-24.04-arm
name: linux-arm64
- os: macos-15
name: macos
runs-on: ${{ matrix.os }}
name: test (${{ matrix.name }})
steps:
- uses: actions/checkout@v6
- name: Select Xcode 16.2
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: Install dotslash
uses: facebook/install-dotslash@v2 # pinned: the moving `latest` branch broke macOS runners (sha256sum flags) on 2026-06-18
# Cache the dotslash-downloaded buck2 binary (~/.cache/dotslash on
# Linux, ~/Library/Caches/dotslash on macOS; actions/cache skips paths
# that don't exist). The previous cache of buck-out/v2/gen +
# ~/.cache/buck2 was inert: OSS buck2 has no persistent action cache
# across daemon restarts, and ~/.cache/buck2 is not a path buck2 uses —
# multi-GB saved/restored for zero hits. (RUE-144)
- name: Cache dotslash artifacts
uses: actions/cache@v5
with:
path: |
~/.cache/dotslash
~/Library/Caches/dotslash
key: dotslash-${{ matrix.name }}-${{ hashFiles('buck2') }}
restore-keys: |
dotslash-${{ matrix.name }}-
# Uses hermetic Rust toolchain downloaded by Buck2
# First verify everything builds (catches issues tests might miss)
- name: Build all targets
run: ./buck2 build //crates/...
# RUE-617: the compiler built above is the first half of this comparison.
# On the required Linux x64 lane, rebuild Rue locally with remote caching
# disabled from a relocated clean source tree and compare the complete
# compiler artifacts. Limiting the extra cold build to one lane keeps the
# merge queue moving while still turning path/scheduling/environment leaks
# into a required failure.
- name: Verify compiler build reproducibility
id: compiler_repro
if: matrix.name == 'linux-x64'
run: ./scripts/check-reproducible-compiler.sh
- name: Upload compiler reproducibility diagnostics
if: failure() && matrix.name == 'linux-x64' && steps.compiler_repro.outcome == 'failure'
uses: actions/upload-artifact@v6
with:
name: compiler-reproducibility-diagnostics
path: ${{ runner.temp }}/rue-compiler-repro-artifacts
if-no-files-found: ignore
- name: Run tests
run: ./test.sh
# Release-mode build + test (RUE-45). Every other job builds the compiler in
# debug, so release-only miscompiles — the ones previously masked by a
# `debug_assert!` that vanishes when `cfg(debug_assertions)` is off (RUE-24 is
# the precedent) — never ran anywhere. This job builds the whole workspace
# optimized via `//platforms:release` (RUE-277 made that a genuinely
# optimized, byte-distinct build) and runs the full suite against it, so
# release codegen is exercised. Bounded to linux-x64 to keep CI time in check;
# the debug matrix above still covers arm64/macOS.
release:
runs-on: ubuntu-latest
name: release (linux-x64)
steps:
- uses: actions/checkout@v6
- name: Install dotslash
uses: facebook/install-dotslash@v2 # pinned: the moving `latest` branch broke macOS runners (sha256sum flags) on 2026-06-18
# Same dotslash cache as the other jobs (buck2 binary only; see the `test`
# job for why buck-out isn't worth caching).
- name: Cache dotslash artifacts
uses: actions/cache@v5
with:
path: |
~/.cache/dotslash
~/Library/Caches/dotslash
key: dotslash-linux-x64-${{ hashFiles('buck2') }}
restore-keys: |
dotslash-linux-x64-
# Regression guard for RUE-277: `//platforms:release` must produce a
# genuinely-optimized binary that differs from the debug build. If the
# opt-level constraint ever silently reverts to a no-op (debug == release,
# as it was before RUE-277), `cmp -s` succeeds and we fail — the release
# suite below would otherwise be a pointless re-run of the debug build.
- name: Assert release build is distinct from debug
run: |
debug_bin="$(./scripts/rue-bin --target-platforms //platforms:debug)"
release_bin="$(./scripts/rue-bin --target-platforms //platforms:release)"
if cmp -s "$debug_bin" "$release_bin"; then
echo "::error::release build is byte-identical to debug — //platforms:release opt-level is a no-op (RUE-277 regression)"
exit 1
fi
echo "release build differs from debug build (optimized) — OK"
# Build every crate optimized (catches build breaks that only surface with
# optimizations on), then run the full suite — including the spec/UI/CLI
# sh_tests, which spawn the release-configured rue binary — so any
# cfg(debug_assertions)-off miscompile is caught.
- name: Build all targets (release)
run: ./buck2 build //crates/... --target-platforms //platforms:release
- name: Run tests (release)
run: ./buck2 test //... --target-platforms //platforms:release