Files
2026-11-18 11:31:51 -05:00

75 lines
2.3 KiB
YAML

name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
build-and-check:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Check out
uses: actions/checkout@v4
- name: Install Lean toolchain
run: |
curl -sSfL https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh \
| sh -s -- -y --default-toolchain none
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
# Mathlib is pinned in `lake-manifest.json`; the cache supplies its
# prebuilt `.olean` files so the job only compiles this project.
- name: Cache Lake packages and build artifacts
uses: actions/cache@v4
with:
path: |
.lake
~/.elan
key: lake-${{ runner.os }}-${{ hashFiles('lean-toolchain', 'lake-manifest.json', 'lakefile.toml') }}
restore-keys: |
lake-${{ runner.os }}-
- name: Fetch Mathlib cache
run: lake exe cache get
- name: Build Lean
run: lake build
# bwrap-free replacement for the comparator's axiom check; catches
# `sorryAx` and any newly introduced axiom in the headline theorems.
- name: Check axioms
run: ./scripts/check-axioms.sh
- name: Install C++ toolchain
run: |
if command -v sudo >/dev/null 2>&1; then SUDO=sudo; else SUDO=; fi
$SUDO apt-get update
$SUDO apt-get install -y clang cmake ninja-build
clang_major="$(clang++ -dumpversion | cut -d. -f1)"
$SUDO apt-get install -y "llvm-${clang_major}"
- name: Configure and build C++
run: |
cmake -S cpp -B cpp/build -G Ninja \
-DCMAKE_CXX_COMPILER=clang++ \
-DCR_BUILD_FUZZERS=OFF \
-DCR_BUILD_BENCH=OFF
cmake --build cpp/build
# `golden_test` and `diff_corpus` read vectors generated by the actual
# Lean `Statement.closedForm`; the file is gitignored.
- name: Generate golden vectors
run: lake env lean --run cpp/oracle/gen.lean > cpp/oracle/golden.txt
- name: Run C++ tests
run: ctest --test-dir cpp/build --output-on-failure
- name: Check C++ coverage
run: |
CXX="clang++-$(clang++ -dumpversion | cut -d. -f1)" \
./cpp/run-coverage.sh