Repository navigation
COMP: Widen CI coverage across platforms, linkage, and configurations - #89
hjmjohnson wants to merge 7 commits into
Conversation
7765c20 to
22e1814
Compare
22e1814 to
f3cd98c
Compare
2defc06 to
82e3261
Compare
82e3261 to
68ab778
Compare
FslGetHdrImgNames and FslSetIntensityScaling are defined here but declared nowhere, while FslGetIntensityScaling and FslInit are already published. axml_recur_find_xml sits beside axml_recur in afni_xml.h the same way. The upstream fslio was deleted in 2015 in favor of a C++ replacement, so this copy is the surviving one and its header is ours to correct. Additive; no symbol changes.
Nine functions in fslio.c have external linkage and no declaration in any header. Nothing in the tree calls them across a translation unit, AFNI's vendored copy never calls them, and no public source outside a vendored copy of this file references them, so a caller would have had to declare them itself. Seven of them are used within fslio.c and become static, with their prototypes collected in one block so the boundary between internal and published is visible in one place. FslSetVoxUnits and FslGetVoxUnits have no caller at all and are deleted. Removes nine exported symbols from libfslio.
nifti1_io.c and nifti2_io.c each define nifti_fileexists with external linkage, so libniftiio and libnifti2 export the same name and ELF link order decides which one a caller linking both resolves to. Declaring it locally silences the warning without choosing between publishing it and making it static; that choice needs the duplication settled first, and it covers a hundred names, not this one. The duplicate definition is left for a later change, because removing either copy or making it static alters the exported API.
nifti2's dsets_test runs nifti_tool against the fetched regression data, like its neighbors, but was the one test in that group without the NEEDS_DATA label. With DOWNLOAD_TEST_DATA=OFF, "ctest -LE NEEDS_DATA" therefore ran it against an empty data path and it failed writing //new_epi.nii.
e115588 to
8c68864
Compare
|
@greptileai review |
gdevenyi
left a comment
There was a problem hiding this comment.
Review by Google Carbon
Verdict: Request Changes
Great work reviving build.yml (main -> master, macos-latest), adding the minimal, oldest-cmake (3.10.2), and exported-symbols baseline checks, and labeling nifti2_dsets_test with NEEDS_DATA!
However, there is one critical CI-hanging blocker that will trigger as soon as this PR merges to master, plus a few important cleanups:
- [CRITICAL BLOCKER] 12-hour polling loop on every
pushtomaster(cmake/github_dashboard.cmake:55-62+cmake/nifti_common.cmake:358-360, 453-458):- Fixing
if(NOT "$ENV{SYSTEM_PULLREQUEST_SOURCEBRANCH}" STREQUAL "")means apushtomasternow enterselseif("$ENV{BUILD_SOURCEBRANCHNAME}" STREQUAL "master")and setsdashboard_model = "Continuous". - In
cmake/nifti_common.cmake:358-360, whendashboard_model STREQUAL "Continuous"anddashboard_loopis unset,nifti_common.cmakesetsdashboard_loop = 43200(12 hours) and loopswhile(NOT dashboard_done)sleeping 300s between iterations! - This never ran on the PR (
Experimental), so merging#89as-is will hang all 5Build and Testjobs (4Linux +1macos-latest) until GitHub Actions' 6-hour job timeout on every commit tomaster! - Fix: Set
set(dashboard_loop 0)andset(dashboard_no_update 1)incmake/github_dashboard.cmake(the latter also preventsctest_update()from runninggit pull origin <pr_branch>, which fails on fork PRs).
- Fixing
- Merge order with
#90:#89carries 3 prototype/linkage commits (3312236,5b001ae,6bc54a4) that overlap#90(after#90resolvesaxml_recur_find_xml). Landing#90first and rebasing#89keeps symbol/prototype changes in one place. - Dead code hunk in
cmake/nifti_common.cmake:270-273, shell robustness incmake/collect_exported_symbols.sh, and lostNIFTI_PACKAGE_PREFIX/INTERPROCEDURAL_OPTIMIZATIONcoverage inbuild.yml(details inline).
| # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml | ||
| # Per-PR build and test matrix; one line per axis: | ||
| # os / c_compiler GNU, Clang, and AppleClang (macOS gcc is a clang shim). | ||
| # shared BUILD_SHARED_LIBS=ON also enables the install and export test. |
There was a problem hiding this comment.
[Google Carbon] Heads-up on two coverage gaps in this matrix:
install_linking(enabled byshared=ON) currently does not actually test the installedNIFTIConfig.cmake:install_linking_test.sh:37passes-DCMAKE_MODULE_PATH=../installed/usr/local/share(wrong path) andGIT_REPO_VERSIONis0.0.0.0(no tags on this repo), sofind_package(NIFTI 3)fails inminimal_example_of_downstream_usageand silently falls back toFetchContentgit clone-ing upstreamNIFTI-Imaging/nifti_clibover the network!- Removing
options: [default, all]means no CI job builds the default out-of-the-boxcmake -B buildconfiguration (USE_NIFTI2_CODE=ON, USE_NIFTICDF_CODE=ON, USE_CIFTI_CODE=OFF, USE_FSL_CODE=OFF).
There was a problem hiding this comment.
Fixed in 4a0d3e0: the matrix now checks out tags (fetch-depth: 0), since the shallow checkout gave version 0.0.0.0 and find_package(NIFTI 3) rejected it; the module path was not the cause, as the installed bin on PATH lets find_package locate the config (locally NIFTI_DIR resolves to the installed tree). A new default job builds a plain cmake -B build with no options.
There was a problem hiding this comment.
Correction: the version half is not fixed. This repository has no tags, so fetch-depth: 0 still gives git describe nothing and version 0.0.0.0; the fix is either pushing the upstream release tags here or changing how the version is derived, which needs a maintainer decision. The new default job does cover the plain cmake -B build configuration.
The 2025 conversion to GitHub Actions replaced .travis.yml with two
workflows but left the dashboard script untouched, so it still
required a Travis environment. The workflow that drives it named the
wrong branch and never ran, which is why nothing surfaced the
mismatch.
Rename travis_dashboard.cmake to github_dashboard.cmake and take its
inputs from the runner that actually exists. CTEST_SITE now comes from
RUNNER_OS rather than the required TRAVIS_APP_HOST, whose absence
aborted the script before it configured anything, and the build name
carries RUNNER_OS in place of TRAVIS_OS_NAME.
Compare the branch name against its value rather than against the
literal string "ENV{BUILD_SOURCEBRANCHNAME}", and give the workflow a
branch name on push events as well as on pull requests. Test the pull
request variables for a value rather than for being defined, since the
workflow sets them empty on push events. A push to master is now
Continuous and a pull request Experimental; Nightly still needs a
scheduled trigger, which the workflow does not have. Set dashboard_loop
to 0, since a Continuous run otherwise polls for 12 hours and would
hold every master job until the runner timeout.
Restore what .travis.yml built: interprocedural optimization on the
coverage, use_prefix, and release entries, and NIFTI_PACKAGE_PREFIX
test_ on use_prefix. The dashboard script now passes the prefix into
the cache; under Travis it was set but never read.
Apply the same corrections to local_dashboard.cmake, whose build name
starts with "local" when RUNNER_OS is unset.
Run the Build and Test workflow on this repository's branch. Its
trigger named "main" while the branch is "master", so it had never
executed on master and did not execute on pull requests; valgrind,
AddressSanitizer, UndefinedBehaviorSanitizer, scan-build, gcov
coverage, and the only shared-library configuration were all
unexercised. Also move its macOS entry off the retired macos-11 image.
Its dashboard fails on any compiler warning; the -Wmissing-declarations
warnings it would report on master are fixed by the preceding commits.
Restructure the per-PR matrix around the axes that change what is
compiled:
shared BUILD_SHARED_LIBS gates TEST_INSTALL, so the ON legs are
the first to run install_linking and cover the install
and export path. The matrix checks out the tags,
so the installed package carries the version that
find_package(NIFTI 3) requires.
fslstyle -DFSLSTYLE is not additive. It rewrites behavior in
niftilib and nifti2 through global -DFSLSTYLE, -DPIGZ and
-DREJECT_COMPLEX, and one site has an #else that changes
the pixdim[0] value written to disk. Neither value
subsumes the other.
build_type One static Debug leg, which is what makes assert() live.
Drop both macos gcc legs: /usr/bin/gcc there is a clang shim reporting
AppleClang, so they duplicated the macos clang legs exactly. The
optional libraries are built everywhere rather than forming an axis,
since they are additive.
Add four jobs. The default job configures with no options, the
configuration a consumer gets out of the box. The minimal configuration
builds znzlib and niftilib alone, which is what a downstream project
vendoring the core reader selects and which nothing else configures. The
oldest supported CMake job guards cmake_minimum_required, invisible to
runners that all carry a recent CMake: it installs CMake 3.10.2 from the
Kitware release and configures, builds, and runs the tests that need no
data, since the test data download uses FetchContent and so needs 3.11.
The exported symbol baseline diffs the dynamic symbol set against a
committed file, so a change to the ABI has to be updated in the same
commit rather than landing unnoticed.
Verified on Ubuntu 24.04 with GCC 13.3.0, the compiler the Linux
runners use:
shared, Release, FSLSTYLE=OFF 345/345, install_linking passed
static, Debug, FSLSTYLE=ON 344/344, no assertion aborts
minimal configures and builds, no tests
CMake 3.10.2 (macOS, no data) 280/280 with -LE NEEDS_DATA
The baseline holds 439 symbols across six libraries: the 448 the
linkage changes have been asserting, less the nine fsliolib functions
the preceding commits made internal.
The workflow steps were exercised by running them directly in the
runner container image rather than through act, whose image omits
cmake.
The dashboard script restates the CTestConfig.cmake settings because CTest's delayed initialization does not pick them up, and the restated copy had drifted from the original. Submit over https rather than http. my.cdash.org serves plain http without redirecting, so submissions were going unencrypted. Use the 00:00:00 EST nightly start time that CTestConfig.cmake declares, rather than 01:00:00 UTC. The two differ by four hours, so nightly builds were filed under the wrong day on the dashboard.
8c68864 to
626f8c7
Compare
Turns on the Build and Test workflow, which never ran on
master, finishes the move from Travis to GitHub Actions, and widens the per-PR matrix. It also fixes the-Wmissing-declarationswarnings that the dashboard now reports and treats as failures.Base is
master. There are 7 commits. The first three are the warning fixes from the open missing-prototypes PR, carried here so this PR is green on its own. All three are patch-identical to #90's, so when #90 lands first a rebase drops them. Merge #90 first.Commits
What the Build and Test legs reported
CDash recorded 4 warnings on every Linux leg, one per translation unit:
nifti1_io.candnifti2_io.c(nifti_fileexists),afni_xml.c(axml_recur_find_xml), andfslio.c(nine internal functions plus two published ones with no header declaration). All four were already present onmaster. They went unnoticed because the workflow's trigger namedmain, so it never ran.Local verification
The CI flag sets were reproduced on macOS with the same dashboard cache (shared, FSL, CIFTI, NIFTI2, applications, and shell tests):
-LE NEEDS_DATA)The exported symbol baseline drops exactly the nine fsliolib symbols, measured by diffing
nmoutput from before and after; nothing was added. Both workflows parse as YAML, andactionlintreports nothing forcmake-multi-platform.yml.With the coverage and valgrind
-Wextraflags, gcc 16 also reports-Wcalloc-transposed-argsin nifti1_io.c and nifti2_io.c. The runners' gcc 13 lacks that warning, so it does not affect CI today.Other changes in review
cmake_minimum_required) from the Kitware release. It configures, builds, and runs the tests that need no data. The data download uses FetchContent, which needs 3.11.masteris now Continuous, and its build name no longer carries a bare-PR. Nightly still needs a scheduled trigger, which the workflow does not have.localwhenRUNNER_OSis unset.ubuntu-24.04, and the collector is invoked withshto match its shebang. The collector is documented as Linux/ELF only.