Skip to content

Root two values that an allocation was collecting under #4496

Root two values that an allocation was collecting under

Root two values that an allocation was collecting under #4496

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
posix:
name: ${{ matrix.os }} / ${{ matrix.cc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cc: gcc
- os: ubuntu-latest
cc: clang
- os: macos-latest
cc: clang
env:
# `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). The test/bench rules
# use separate compile and link steps so the compile step is
# in sccache's cacheable pattern; the test compile also loads
# a precompiled spinel_rt.h (see PCH_ROOT in the Makefile),
# which cuts the compile even when sccache misses. sccache
# hashes the preprocessed source, so the gcc-implicit .gch
# never leaks into the cache key; for clang's -include-pch
# sccache declines to cache and forwards, which still gets
# the PCH speedup.
CC: sccache ${{ matrix.cc }}
SCCACHE_GHA_ENABLED: "true"
# Room for the slow GHA-backed server startup (default ~10s); keep it
# alive across steps. See the pre-start step below.
SCCACHE_STARTUP_TIMEOUT: "30"
SCCACHE_IDLE_TIMEOUT: "0"
steps:
- uses: actions/checkout@v6
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
# Start the server once here so `make -j` clients don't race to start it.
- name: Pre-start sccache server
run: sccache --start-server
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- name: Expose GNU coreutils on PATH (macOS)
if: runner.os == 'macOS'
run: echo "/opt/homebrew/opt/coreutils/libexec/gnubin" >> "$GITHUB_PATH"
- name: Fetch libprism sources
run: make deps
- name: Build (parse + regexp + spinelc)
run: make -j$(getconf _NPROCESSORS_ONLN) all
- name: Run tests
# Opt level is compiler-specific -- they behave oppositely on the
# spinel_rt.h-heavy per-test TUs (800+ static fns):
# gcc: -O1 prunes unreferenced statics + DCEs before the costly
# codegen, so -O1 compiles ~9x FASTER than -O0 (2.7 vs 25ms).
# clang: -O1 still runs the full optimizer over every emitted inline
# static, so -O1 is ~2.5x SLOWER than -O0 (213 vs 88ms/file).
# So gcc builds tests at -O1 and clang at -O0. Correctness is opt-level
# independent (tests diff output, not codegen), and the gcc -O1 leg still
# exercises the optimizing path; the clang leg's job is that clang accepts
# the emitted C and runs it, which -O0 covers.
# The clang legs also bypass sccache (CC override): sccache declines to
# cache clang's -include-pch compiles, so wrapping ~2000 compile+link
# invocations only adds client-spawn overhead on top of the PCH speedup.
# gcc keeps the wrapper -- its PCH rides the implicit .gch lookup, which
# sccache's preprocessor hashing doesn't see, so gcc tests get cache hits
# AND the PCH fallback.
run: make -j$(getconf _NPROCESSORS_ONLN) test ${{ matrix.cc == 'clang' && 'OPT=-O0 CC=clang' || 'OPT=-O1' }}
# Benchmark integration test. Compiles every benchmark/*.rb through
# the full pipeline (cc -Werror) and diffs the output against CRuby.
# The bench programs are larger and more realistic than the test/*.rb
# fixtures, so they exercise object-graph shapes (cons cells, tree
# nodes, linked structures) that `make test` misses -- a holder
# specialization regression once slipped past test + optcarrot
# precisely because bench wasn't gated. Linux/gcc only: the output
# is deterministic across compilers/OS, and the gcc job's test step
# runs well under the clang jobs' (sccache covers more of its
# compiles), so it carries both bench and optcarrot to keep the
# slowest job -- which sets the CI wall time -- the clang test run.
- name: Run benchmark integration test
if: matrix.os == 'ubuntu-latest' && matrix.cc == 'gcc'
run: make bench
# End-to-end optcarrot integration test. Linux only — no
# value in repeating it across compilers / on macOS, since
# the codegen output is the same and the runtime cost
# (~10s) is the same too. Catches regressions in the
# `pack-for-spinel.rb` flow + Lan_Master.nes checksum 59662
# contract that the standalone `make test` doesn't cover.
- name: Run optcarrot integration test
if: matrix.os == 'ubuntu-latest' && matrix.cc == 'gcc'
run: make optcarrot
- name: sccache stats
if: always()
run: sccache --show-stats