Add CI workflow that runs the C++ test suite#54
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new GitHub Actions workflow (
.github/workflows/test.yml) that builds nuSQuIDS via the autotools path and runstest/run_testson every PR and on pushes tomaster.The existing
build_wheels.ymlonly verifies that the wheel compiles across architectures; it never executes the 21 unit tests intest/. With this workflow in place, the test suite can be added as a required status check in themasterbranch protection rule, so no PR can merge if it breaks tests.What the job does
apt-get installGSL + HDF5 + pkg-config (Ubuntu runners ship GSL 2.x, well above the >= 1.15 requirement).jsalvado/SQuIDSmaster,./configure --with-gsl=/usr, build, install to~/squids-install../configurenuSQuIDS pointing at the dependency prefixes.make -j$(nproc).cd test && bash run_tests.test/Report.txtand exit non-zero on any line containingFAILthat is notFAIL (Expected)—run_testswrites results to the report but always exits 0, so an explicit check is required.Report.txtas an artifact for postmortem (even on failure).What this does NOT cover
master. If upstream breaks our CI, we should pin to a known-good tag/SHA in a follow-up.Test plan
tail -1 Report.txtin the workflow log shows21 Tests: 21 passes, 0 failuresmasterbranch protection rule edited to require the newC++ test suitestatus checkFollow-ups (separate PRs)
🤖 Generated with Claude Code