Pin actions/checkout, setup-python, cache, and upload-artifact to full-length commit SHAs across the bench, lint, precision-gate, and tsan workflows (supply-chain hardening; mutable tags can be re-pointed).
105 lines
3.7 KiB
YAML
105 lines
3.7 KiB
YAML
name: bench
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
# Weekly: Monday 06:00 UTC. Quiet hour for most regions; avoids the
|
|
# workday CI rush so we don't queue behind other people's PRs.
|
|
- cron: "0 6 * * 1"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: bench-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
fixtures-smoke:
|
|
# The default smoke target is the self-contained fold-fixtures corpus.
|
|
# POJ-104 / SARD runs live in their own opt-in workflow once the
|
|
# corpora/<name>/fetch.sh scripts are wired up.
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
|
|
- name: Install system deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
clang-19 clang-tidy-19 \
|
|
llvm-19-dev libclang-19-dev libclang-cpp19-dev \
|
|
libz3-dev libsqlite3-dev \
|
|
meson ninja-build pkg-config \
|
|
nlohmann-json3-dev \
|
|
libcli11-dev libspdlog-dev libfmt-dev
|
|
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install Conan
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install "conan>=2,<3"
|
|
conan profile detect --force
|
|
|
|
- name: Cache Conan
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: ~/.conan2
|
|
key: conan-bench-${{ hashFiles('conanfile.py') }}
|
|
|
|
- name: Configure + build fold (release)
|
|
env:
|
|
CC: clang-19
|
|
CXX: clang++-19
|
|
run: |
|
|
conan install . --output-folder=build/release --build=missing \
|
|
-s build_type=Release -o build_tests=False
|
|
ln -sf /usr/lib/x86_64-linux-gnu/pkgconfig/z3.pc build/release/z3.pc
|
|
meson setup build/release \
|
|
--native-file build/release/conan_meson_native.ini \
|
|
-Dcpp_std=c++23 \
|
|
-Dllvm-config-path="$(command -v llvm-config-19)"
|
|
meson compile -C build/release
|
|
|
|
- name: Run bench (fold-fixtures corpus)
|
|
run: |
|
|
mkdir -p bench/corpora
|
|
ln -sfn ../../tests/fixtures/clones bench/corpora/fold-fixtures
|
|
python3 bench/run_bench.py \
|
|
--corpus bench/corpora/fold-fixtures \
|
|
--name fold-fixtures \
|
|
--tools fold,clang-tidy \
|
|
--processes 1 \
|
|
--detectors clone
|
|
|
|
- name: Score against gold
|
|
run: |
|
|
LATEST="$(python3 -c 'from pathlib import Path; paths=sorted(p.name for p in Path("bench/results").iterdir() if p.is_dir()); print(paths[-1] if paths else "")')"
|
|
test -n "$LATEST"
|
|
python3 bench/score.py \
|
|
--run-dir "bench/results/${LATEST}" \
|
|
--gold bench/gold/fold-fixtures.json
|
|
|
|
- name: SARIF determinism check
|
|
run: |
|
|
./build/release/src/cli/fold scan \
|
|
--compile-db tests/fixtures/compile_commands.json \
|
|
--format sarif --detectors clone --min-body-stmts 1 \
|
|
--processes 1 --output /tmp/run1.sarif
|
|
./build/release/src/cli/fold scan \
|
|
--compile-db tests/fixtures/compile_commands.json \
|
|
--format sarif --detectors clone --min-body-stmts 1 \
|
|
--processes 1 --output /tmp/run2.sarif
|
|
diff -u /tmp/run1.sarif /tmp/run2.sarif
|
|
|
|
- name: Upload bench artifacts
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: bench-results
|
|
path: bench/results/
|
|
if-no-files-found: ignore
|