ci: switch to commit-message triggers (replace issue_comment)

issue_comment triggers had two problems: Gitea did not reliably fire
them, and the refs/pull/N/head checkout was fragile.  Commit-message
keywords are simpler and guaranteed to work on any push event.

Trigger keywords (add anywhere in the commit message):
  /test-cgal      → CGAL test suite (277 tests, LOW_MEMORY_BUILD)
  /quality-gates  → license/codespell/shellcheck/cgal-conventions
  /docs           → Doxygen build + warning summary
  /links          → Markdown internal link check

test-fast still runs on every push (no keyword needed).

All `issue_comment` event handlers and `refs/pull/N/head` checkouts
removed from all three workflow files.  review/** added to push branch
filters so this PR branch triggers normally.

CLAUDE.md CI table updated.

/test-cgal /quality-gates
This commit is contained in:
Tarik Moussa
2026-05-31 01:14:53 +02:00
parent 018484a94d
commit 7df47c0435
4 changed files with 59 additions and 90 deletions

View File

@@ -1,5 +1,14 @@
name: C++ Tests
# Trigger keywords in commit message (checked via head_commit.message):
# /test-cgal — full CGAL test suite (277 tests, ~5 min build)
# /quality-gates — license, codespell, shellcheck, CGAL conventions
#
# Example commit:
# git commit -m "fix: correct angle formula /test-cgal"
#
# test-fast always runs on every push — it is fast (< 5 s) and cheap.
on:
push:
branches:
@@ -7,15 +16,13 @@ on:
- dev
- "claude/**"
- "feature/**"
- "review/**"
pull_request:
# /test-cgal comment on any PR triggers the CGAL test suite manually.
issue_comment:
types: [created]
# ─────────────────────────────────────────────────────────────────────────────
# Job 1 — test-fast
# Pure-math tests (Clausen, ImLi₂, Hyper-ideal geometry).
# No CGAL, no Boost. Eigen + GTest only. Runs on ALL branches.
# No CGAL, no Boost. Eigen + GTest only. Runs on EVERY push.
# ─────────────────────────────────────────────────────────────────────────────
jobs:
test-fast:
@@ -51,59 +58,32 @@ jobs:
# ─────────────────────────────────────────────────────────────────────────────
# Job 2 — test-cgal
# Full CGAL test suite (Phase 37, 158 tests).
# Runs ONLY on pull requests (not on direct pushes to dev/main).
# Starts only after test-fast succeeds.
#
# Uses -DWITH_CGAL_TESTS=ON (not -DWITH_CGAL=ON) to avoid building
# Viewer/GLFW — the CI container has no wayland-scanner.
# Trigger: include "/test-cgal" anywhere in the commit message.
#
# Boost (libboost-dev) is already present in the container since the image rebuild.
# git commit -m "fix: correct angle formula /test-cgal"
#
# Why keyword-triggered (not automatic on every push):
# The Pi runner (3-4 GB RAM, swap heavily loaded) cannot sustain a
# CGAL build on every WIP commit. Adding the keyword to a commit
# message explicitly signals "this commit is ready for full testing".
#
# LOW_MEMORY_BUILD applies four RAM-saving measures so the build fits in
# a 2000 MB container: -O0, no PCH, unity batch 1, --no-keep-memory.
# See code/tests/cgal/CMakeLists.txt for the full explanation.
# ─────────────────────────────────────────────────────────────────────────────
# ─── CGAL tests: manual trigger via PR comment ───────────────────────────
#
# Trigger: write "/test-cgal" as a comment on any pull request.
#
# Why comment-triggered (not automatic on every PR push):
# The Pi runner has 3-4 GB RAM total with swap constantly loaded.
# Even with LOW_MEMORY_BUILD the CGAL build takes ~5 min and stresses
# the runner. Triggering on every push would queue builds faster than
# the Pi can drain them. A manual trigger gives full control: run the
# 277-test suite when a PR is ready for review, not on every WIP commit.
#
# How it works:
# - `issue_comment` fires on all PR + issue comments.
# - The `if:` condition checks:
# 1. Event is a comment (not a push or PR sync)
# 2. The comment is on a PR (issue.pull_request != null)
# 3. The comment body contains "/test-cgal"
# - The checkout uses refs/pull/N/head to get the PR branch, because
# `issue_comment` does not set GITHUB_REF to the PR branch by default.
#
# LOW_MEMORY_BUILD applies four RAM-saving measures so the build fits in
# 2000 MB: -O0, PCH off, unity batch 1, --no-keep-memory linker.
# See code/tests/cgal/CMakeLists.txt for the full explanation.
test-cgal:
needs: test-fast
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
contains(github.event.comment.body, '/test-cgal')
if: contains(github.event.head_commit.message, '/test-cgal')
runs-on: eulernest
container:
image: git.eulernest.eu/conformallab/ci-cpp:latest
# 2000 MB hard limit; 1000 MB swap headroom (memory-swap = RAM + swap).
# Uses ~half of the Pi's 3-4 GB, leaving margin for OS + runner daemon.
# With LOW_MEMORY_BUILD peak per TU is ~150-200 MB → well within limit.
options: "--memory=2000m --memory-swap=3000m"
steps:
# Check out the PR branch, not the default branch.
# issue_comment events set GITHUB_REF to the default branch; we need
# refs/pull/N/head to get the actual PR code.
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Configure (LOW_MEMORY_BUILD — -O0, no PCH, unity batch 1)
run: |
@@ -133,44 +113,29 @@ jobs:
echo "CGAL ▸ TOTAL ${total:-0} | PASSED $passed | FAILED ${failed:-0} | SKIPPED ${skipped:-0}"
fi
# ── Structural gate: doc/api/tests.md totals match ctest reality ───
# Single source of truth for test counts (see doc/release-policy.md).
# Reuses the already-built ./build dir via BUILD_DIR env var, so this
# adds ~5 s on top of the existing CGAL job.
- name: Verify test-count consistency (doc/api/tests.md)
run: BUILD_DIR=build bash scripts/check-test-counts.sh
# ── Structural gate: end-to-end smoke (try_it.sh) ──────────────────
# The user-facing quick-start script: configure + build + run the
# full ctest + run the Euclidean example on a bundled mesh. If
# this regresses, README quick-start instructions are broken.
# try_it.sh creates its own build-try/ — accept the ~3 min cost as
# the price of guaranteeing the documented workflow stays working.
- name: End-to-end smoke test (scripts/try_it.sh)
run: bash scripts/try_it.sh
# ─────────────────────────────────────────────────────────────────────────────
# Job 3 — quality-gates (style + convention block)
# Job 3 — quality-gates
#
# Trigger: write "/quality-gates" as a comment on any pull request.
# Trigger: include "/quality-gates" anywhere in the commit message.
#
# Cheap, deterministic checks (~30 s): license headers, CGAL conventions,
# codespell, shellcheck. Runs independently of test-fast when comment-
# triggered (no `needs:` — the caller decides when to invoke it).
# git commit -m "chore: update docs /quality-gates"
#
# Cheap (~30 s): license headers, CGAL conventions, codespell, shellcheck.
# ─────────────────────────────────────────────────────────────────────────────
quality-gates:
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
contains(github.event.comment.body, '/quality-gates')
if: contains(github.event.head_commit.message, '/quality-gates')
runs-on: eulernest
container:
image: git.eulernest.eu/conformallab/ci-cpp:latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Install codespell + shellcheck (job-local)
run: |

View File

@@ -1,11 +1,19 @@
name: API Docs
# Trigger: write "/docs" as a comment on any pull request.
# Also available via workflow_dispatch for manual runs outside a PR context.
# Trigger: include "/docs" anywhere in the commit message.
#
# git commit -m "docs: update API examples /docs"
#
# Also available via workflow_dispatch for manual runs.
on:
issue_comment:
types: [created]
push:
branches:
- main
- dev
- "claude/**"
- "feature/**"
- "review/**"
workflow_dispatch: {}
# ─────────────────────────────────────────────────────────────────────────────
@@ -14,25 +22,18 @@ on:
# Generates Doxygen HTML from the public headers and reports warning
# statistics. Does NOT block merges: `continue-on-error: true` ensures
# warnings or extraction issues never fail.
#
# Trigger: "/docs" PR comment (or workflow_dispatch for manual runs).
# Checkout uses refs/pull/N/head when triggered via comment.
# ─────────────────────────────────────────────────────────────────────────────
jobs:
doc-build:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
contains(github.event.comment.body, '/docs'))
contains(github.event.head_commit.message, '/docs')
runs-on: eulernest
container:
image: git.eulernest.eu/conformallab/ci-cpp:latest
continue-on-error: true # never block the merge
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }}
- name: Generate API documentation
run: doxygen Doxyfile 2>&1 | tee doxygen.log

View File

@@ -4,13 +4,20 @@ name: Markdown link check
# file (or anchor).
#
# Triggers:
# - "/links" as a PR comment (manual, on the PR branch)
# - Weekly cron Mon 05:00 UTC (catches link rot without any PR activity)
# - workflow_dispatch (manual run on any branch)
# - "/links" in commit message (manual, on that exact commit)
# - Weekly cron Mon 05:00 UTC (catches link rot without any activity)
# - workflow_dispatch (manual run on any branch)
#
# git commit -m "docs: rename section /links"
on:
issue_comment:
types: [created]
push:
branches:
- main
- dev
- "claude/**"
- "feature/**"
- "review/**"
schedule:
- cron: "0 5 * * 1" # Monday 05:00 UTC weekly link-rot check
workflow_dispatch: {}
@@ -20,17 +27,13 @@ jobs:
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
contains(github.event.comment.body, '/links'))
contains(github.event.head_commit.message, '/links')
runs-on: eulernest
container:
image: git.eulernest.eu/conformallab/ci-cpp:latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }}
# ── Pure-python internal link check (no external network needed) ────
# We use the same logic that found the 2 broken links before the

View File

@@ -265,10 +265,10 @@ Three jobs in `.gitea/workflows/cpp-tests.yml`:
| Job | CMake flags | Deps | Triggers on | Status |
|---|---|---|---|---|
| `test-fast` | *(none)* | Eigen + GTest only | all branches (auto) | **active** |
| `test-cgal` | `-DWITH_CGAL_TESTS=ON -DCONFORMALLAB_LOW_MEMORY_BUILD=ON` | + Boost | `/test-cgal` PR comment | **active** |
| `quality-gates` | *(none)* | + codespell, shellcheck | `/quality-gates` PR comment | **active** |
| `doc-build` | *(none)* | Doxygen | `/docs` PR comment or `workflow_dispatch` | **active** |
| `markdown-links` | *(none)* | python3 | `/links` PR comment, weekly cron, `workflow_dispatch` | **active** |
| `test-cgal` | `-DWITH_CGAL_TESTS=ON -DCONFORMALLAB_LOW_MEMORY_BUILD=ON` | + Boost | `/test-cgal` in commit message | **active** |
| `quality-gates` | *(none)* | + codespell, shellcheck | `/quality-gates` in commit message | **active** |
| `doc-build` | *(none)* | Doxygen | `/docs` in commit message or `workflow_dispatch` | **active** |
| `markdown-links` | *(none)* | python3 | `/links` in commit message, weekly cron, `workflow_dispatch` | **active** |
Runner: `eulernest` — self-hosted Raspberry Pi, ARM64, Ubuntu 22.04. Docker image: `git.eulernest.eu/conformallab/ci-cpp:latest`. `test-cgal` and `quality-gates` both need `test-fast` to pass first (`needs: test-fast`).