CI gates (active on every PR via .gitea/workflows/)
───────────────────────────────────────────────────
1. test-count consistency
cpp-tests.yml gains a step after test-cgal that runs
`scripts/check-test-counts.sh` against the just-built ./build dir
(reuse via new BUILD_DIR env var, ~5 s overhead). Drift between
`doc/api/tests.md` and ctest reality now fails the PR.
2. End-to-end smoke
`scripts/try_it.sh` (the documented user quick-start) is now part of
the CGAL job, so README quick-start regressions fail the PR rather
than silently breaking when users land.
3. Internal markdown link checker
New `.gitea/workflows/markdown-links.yml` + `scripts/check-markdown
-links.py`. PRs that touch any *.md file run the check; main pushes
trigger it too; a weekly cron catches external link rot. Pure
Python, no third-party action. Validated against the current tree:
122 internal links across 37 *.md files, 0 broken.
Local quality scripts (`scripts/quality/`, not in CI)
─────────────────────────────────────────────────────
* `license-headers.sh` — `SPDX-License-Identifier: MIT` audit over
code/{include,src,tests}/. Currently
reports 60/66 files missing it — that's
a follow-up; the script captures the
structural gap.
* `sanitizers.sh` — ASan + UBSan over the fast test suite.
* `coverage.sh` — gcov/lcov line + branch coverage of
code/include/, HTML report under
build-coverage/lcov-html/.
* `clang-tidy.sh` — runs the curated `.clang-tidy` policy over
every public header.
* `multi-compiler.sh` — sequential build + test against every
detected g++/clang++ (auto-discovery or
explicit list).
* `cgal-version-matrix.sh`— sequential build + CGAL test suite against
every CGAL tree under `~/cgal/<ver>/` (or
via `CGAL_ROOTS=...` env var).
* `reproducible-build.sh`— two `Release -j1` builds, fail if any test
executable byte-differs.
* `run-all.sh` — driver: `--fast` for the ~5-min subset,
no arg for the ~25–40 min full sweep;
captures per-gate logs to
build-quality-logs/.
+ `.clang-tidy` — curated, deliberately-small policy (only
checks that fire on OUR code, never on
transitive CGAL/Eigen/Boost headers).
+ `scripts/quality/README.md` — explains the structure, lists each
gate's wall-time + prereqs, and codifies
the promotion path: a gate moves into CI
only when it's green on the dev machine
AND has a recovery-instructions paragraph
in `doc/release-policy.md`.
Doc updates
───────────
`doc/architecture/locked-vs-flexible.md` (reviewer-facing) gains 4
"closed" rows in the limitations table — the 3 CI gates above and the
local quality-script suite.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
120 lines
3.8 KiB
Bash
Executable File
120 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/quality/multi-compiler.sh
|
|
#
|
|
# Build and test the fast (non-CGAL) suite against multiple C++
|
|
# compilers in sequence. Catches compiler-specific issues:
|
|
# * gcc-only extensions accidentally used
|
|
# * clang's stricter template-error handling
|
|
# * libstdc++ vs libc++ ABI assumptions
|
|
#
|
|
# Local-only. Each compiler gets its own build-multi-<cc>/ directory.
|
|
#
|
|
# Usage:
|
|
# bash scripts/quality/multi-compiler.sh # auto-detect
|
|
# bash scripts/quality/multi-compiler.sh g++ clang++ # specific list
|
|
#
|
|
# Exit codes:
|
|
# 0 every detected/selected compiler builds + tests cleanly
|
|
# 1 at least one compiler failed
|
|
# 2 fewer than 2 compilers available
|
|
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
# ── Pick compilers ──────────────────────────────────────────────────────────
|
|
if [ $# -gt 0 ]; then
|
|
COMPILERS=("$@")
|
|
else
|
|
COMPILERS=()
|
|
for cand in g++ g++-13 g++-12 g++-11 clang++ clang++-17 clang++-16 clang++-15; do
|
|
if command -v "$cand" >/dev/null 2>&1; then
|
|
COMPILERS+=("$cand")
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [ "${#COMPILERS[@]}" -lt 1 ]; then
|
|
echo "FAIL: no C++ compilers detected. Install gcc and/or clang." >&2
|
|
exit 2
|
|
fi
|
|
|
|
echo "========================================"
|
|
echo " Multi-compiler build matrix"
|
|
echo " compilers: ${COMPILERS[*]}"
|
|
echo "========================================"
|
|
echo
|
|
|
|
# De-duplicate by resolving each to its absolute path.
|
|
declare -a UNIQ_BINS=()
|
|
declare -a UNIQ_NAMES=()
|
|
seen=""
|
|
for cc in "${COMPILERS[@]}"; do
|
|
if ! command -v "$cc" >/dev/null 2>&1; then
|
|
echo " skip $cc (not in PATH)"
|
|
continue
|
|
fi
|
|
full="$(command -v "$cc")"
|
|
if echo "$seen" | grep -qx "$full"; then
|
|
continue
|
|
fi
|
|
seen="$seen
|
|
$full"
|
|
UNIQ_BINS+=("$full")
|
|
# Use a sanitised name for the build dir (replace + and / etc.).
|
|
safe="$(echo "$cc" | sed 's|[/+]|_|g')"
|
|
UNIQ_NAMES+=("$safe")
|
|
done
|
|
|
|
if [ "${#UNIQ_BINS[@]}" -lt 2 ]; then
|
|
echo "WARNING: only ${#UNIQ_BINS[@]} unique compiler(s) — matrix is degenerate."
|
|
echo " (continuing anyway; install a second toolchain for full coverage)"
|
|
fi
|
|
|
|
# ── Run each ────────────────────────────────────────────────────────────────
|
|
overall=0
|
|
i=0
|
|
for cc in "${UNIQ_BINS[@]}"; do
|
|
name="${UNIQ_NAMES[$i]}"
|
|
i=$((i + 1))
|
|
build="build-multi-$name"
|
|
echo
|
|
echo "── [$i/${#UNIQ_BINS[@]}] $name ─────────────────────"
|
|
echo " bin: $cc"
|
|
echo " build: $build"
|
|
|
|
if ! cmake -S code -B "$build" \
|
|
-DCMAKE_CXX_COMPILER="$cc" \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-Wno-dev >/dev/null 2>&1; then
|
|
echo " CONFIGURE FAILED"
|
|
overall=1
|
|
continue
|
|
fi
|
|
|
|
if ! nice -n 19 cmake --build "$build" --target conformallab_tests \
|
|
-j"$(nproc 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || echo 2)" \
|
|
>"$build/build.log" 2>&1; then
|
|
echo " BUILD FAILED — see $build/build.log"
|
|
overall=1
|
|
continue
|
|
fi
|
|
|
|
if ! ( cd "$build" && ctest -E "^cgal\." --output-on-failure >"test.log" 2>&1 ); then
|
|
echo " TESTS FAILED — see $build/test.log"
|
|
overall=1
|
|
continue
|
|
fi
|
|
|
|
pass=$(grep -oE "tests passed.*out of [0-9]+" "$build/test.log" | head -1)
|
|
echo " OK ($pass)"
|
|
done
|
|
|
|
echo
|
|
if [ $overall -eq 0 ]; then
|
|
echo "OK: every selected compiler built + passed the fast test suite."
|
|
else
|
|
echo "FAIL: at least one compiler did not produce a green test run."
|
|
fi
|
|
exit $overall
|