Skip to content

fix(cli): look a compiler answer up by the name the file is filed under #46

fix(cli): look a compiler answer up by the name the file is filed under

fix(cli): look a compiler answer up by the name the file is filed under #46

Workflow file for this run

name: CI
# What every change is checked against. Everything here runs on one runner
# family and is expected to finish quickly enough to read before moving on;
# the checks that need a second operating system, a compiler helper, or a real
# build toolchain live in the verify workflow, which runs when a change lands
# on main.
on:
push:
branches: [main, develop]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
lint:
name: fmt + clippy + docs + boundaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Verify compiler helper boundaries
run: make verify-helper-boundaries
- name: Verify artifact dependency boundary
run: make verify-artifact-boundaries
- name: Docs
run: cargo doc --workspace --no-deps --all-features
env:
RUSTDOCFLAGS: "-D warnings"
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
# `rust-toolchain.toml` names the components, `rust-src` among them.
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# The suite includes the Semantic-mode tests, which ask the C/C++ helper
# about real translation units. It loads libclang at run time and reads a
# control-flow graph by invoking `clang` separately, so both the library
# and the unversioned driver have to be here. Neither is a CI-only extra:
# they are what running this suite needs anywhere.
- name: Install Clang and libclang
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang libclang-dev libc++-dev libc++abi-dev
# The labelled precision tests refuse to pass on an empty measurement:
# with no case materialized they report that nothing was measured rather
# than reporting success. The suite therefore needs the same sources the
# accuracy job fetches.
- name: Materialize the labelled corpora
run: corpus/scripts/materialize-labeled.sh
# Formatting, lints and docs belong to the lint job. Running them here as
# well only buys a second copy of the same answer.
#
# Every test binary runs, rather than stopping at the first one that
# fails. A fault that only shows on one platform is rarely alone, and
# stopping at the first means meeting the next a full round trip later.
- name: Test
run: cargo test --workspace --all-targets --all-features --no-fail-fast
helperless-modes:
name: Fast and Structural without compiler helpers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
# Do not restore a target directory from another job. This package-only
# build compiles the CLI and its library dependencies, never either
# compiler-helper binary.
- name: Exercise helper-free modes
run: cargo test -p codehelion --test scan fast_and_structural_modes_run_without_compiler_helpers
env:
CARGO_TARGET_DIR: ${{ runner.temp }}/codehelion-helperless-target
accuracy:
name: detection accuracy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# The labelled cases record a commit, not the code it names: the sources
# belong to the projects they came from and are fetched here rather than
# committed. Without this step the accuracy run still passes, with every
# labelled case reported as unscored — which is the point of the step.
- name: Materialize the labelled corpora
run: corpus/scripts/materialize-labeled.sh
- name: Measure
run: make eval
packaging:
name: publishable crates build from their own package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Building a crate from its own package directory is the only thing that
# reads it the way a dependent will, and nothing else in this workflow
# does. Asking on every change rather than at release time keeps the
# answer current: the alternative is finding out at the tag that a crate
# has been unbuildable from its own tarball for weeks.
- name: Package every publishable crate
run: make verify-packaging
msrv:
name: minimum supported rust version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@1.85.0
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --all-features
deny:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: EmbarkStudios/cargo-deny-action@v2