Skip to content

Add CI workflow that runs the C++ test suite#54

Merged
arguelles merged 2 commits into
masterfrom
ci/add-test-workflow
May 8, 2026
Merged

Add CI workflow that runs the C++ test suite#54
arguelles merged 2 commits into
masterfrom
ci/add-test-workflow

Conversation

@arguelles

Copy link
Copy Markdown
Owner

Summary

Adds a new GitHub Actions workflow (.github/workflows/test.yml) that builds nuSQuIDS via the autotools path and runs test/run_tests on every PR and on pushes to master.

The existing build_wheels.yml only verifies that the wheel compiles across architectures; it never executes the 21 unit tests in test/. With this workflow in place, the test suite can be added as a required status check in the master branch protection rule, so no PR can merge if it breaks tests.

What the job does

  1. apt-get install GSL + HDF5 + pkg-config (Ubuntu runners ship GSL 2.x, well above the >= 1.15 requirement).
  2. Clone SQuIDS from jsalvado/SQuIDS master, ./configure --with-gsl=/usr, build, install to ~/squids-install.
  3. ./configure nuSQuIDS pointing at the dependency prefixes.
  4. make -j$(nproc).
  5. cd test && bash run_tests.
  6. Parse test/Report.txt and exit non-zero on any line containing FAIL that is not FAIL (Expected)run_tests writes results to the report but always exits 0, so an explicit check is required.
  7. Always upload Report.txt as an artifact for postmortem (even on failure).

What this does NOT cover

  • CUDA tests — GitHub free runners have no GPUs; CUDA testing stays on the cluster.
  • macOS — wheel CI already covers macOS arm64 build; adding test-runner support there is a follow-up (different dep paths via Homebrew).
  • Compiler matrix — single GCC row for now; can expand later if value emerges.
  • SQuIDS pinning — currently tracking SQuIDS master. If upstream breaks our CI, we should pin to a known-good tag/SHA in a follow-up.

Test plan

  • CI runs successfully on this PR (verifies the workflow itself works on a clean Ubuntu runner)
  • tail -1 Report.txt in the workflow log shows 21 Tests: 21 passes, 0 failures
  • After merge: master branch protection rule edited to require the new C++ test suite status check

Follow-ups (separate PRs)

  • Pin SQuIDS clone to a specific commit
  • Add caching for the SQuIDS install (~30 s saved per run)
  • Consider adding a macOS row once we have a clean Homebrew-based dep recipe

🤖 Generated with Claude Code

arguelles and others added 2 commits May 9, 2026 03:51
Existing CI only builds wheels; it does not exercise the test suite.
This adds a workflow that builds GSL/HDF5 from apt, builds SQuIDS from
source, builds nuSQuIDS via the autotools path, runs test/run_tests,
and parses Report.txt to fail the job on any non-expected failure.

Intended to become a required status check on master.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two fragilities surfaced when the test ran on Linux (libstdc++/gcc) for
the first time, while it had only ever been validated on macOS (libc++/
clang):

1. CrossSectionLibrary::targets() returned the underlying unordered_map
   keys in implementation-defined order, so the printed target list
   differed between platforms. Sort the result before returning. This
   tightens (rather than breaks) the public contract: callers that
   relied on the previous random order were already buggy.

2. test/nuclear_xs.test.cpp printed the p/n vs nuclear flux comparison
   at setprecision(4); the 4th decimal place jittered between platforms
   due to FP intrinsic / order-of-ops differences (~1e-4 relative).
   Reduce to setprecision(3); the differences vanish at this width and
   the test still asserts the physics-meaningful agreement.

Reference output regenerated on macOS to match the new sorted /
3-precision format.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@arguelles arguelles merged commit 6f93263 into master May 8, 2026
13 checks passed
@arguelles arguelles deleted the ci/add-test-workflow branch May 8, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant