Skip to content

COMP: Widen CI coverage across platforms, linkage, and configurations - #89

Open
hjmjohnson wants to merge 7 commits into
masterfrom
ci/widen-coverage
Open

hjmjohnson wants to merge 7 commits into
masterfrom
ci/widen-coverage

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

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-declarations warnings 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
  1. ENH: Declare the three functions that have a published counterpart
  2. COMP: Give the fsliolib internal functions static linkage (this removes nine undeclared exports from libfslio)
  3. COMP: Declare nifti_fileexists where it is defined
  4. COMP: Label nifti2's dsets test as needing the test data
  5. COMP: Finish the migration from Travis to GitHub Actions
  6. COMP: Widen CI coverage across platforms, linkage, and configurations (turns the Build and Test workflow on)
  7. COMP: Submit dashboard results over https, at the documented start time
What the Build and Test legs reported

CDash recorded 4 warnings on every Linux leg, one per translation unit: nifti1_io.c and nifti2_io.c (nifti_fileexists), afni_xml.c (axml_recur_find_xml), and fslio.c (nine internal functions plus two published ones with no header declaration). All four were already present on master. They went unnoticed because the workflow's trigger named main, 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):

Configuration Project warnings Tests
gcc-16, no flags (use_prefix) 14 before, 0 after 344/344
clang, sanitize flags 0 345/345
CMake 3.10.2, no test data n/a 280/280 (-LE NEEDS_DATA)

The exported symbol baseline drops exactly the nine fsliolib symbols, measured by diffing nm output from before and after; nothing was added. Both workflows parse as YAML, and actionlint reports nothing for cmake-multi-platform.yml.

With the coverage and valgrind -Wextra flags, gcc 16 also reports -Wcalloc-transposed-args in 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
  • The oldest-CMake job now installs CMake 3.10.2 (the 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.
  • The dashboard scripts now check that the pull request variables are non-empty, not just defined. A push to master is now Continuous, and its build name no longer carries a bare -PR. Nightly still needs a scheduled trigger, which the workflow does not have.
  • The local dashboard build name starts with local when RUNNER_OS is unset.
  • The exported-symbols job is pinned to ubuntu-24.04, and the collector is invoked with sh to match its shebang. The collector is documented as Linux/ELF only.

@hjmjohnson
hjmjohnson marked this pull request as ready for review September 24, 2026 12:03
@hjmjohnson
hjmjohnson force-pushed the ci/build-all-codepaths branch from 7765c20 to 22e1814 Compare October 6, 2026 14:35
@hjmjohnson
hjmjohnson marked this pull request as draft October 6, 2026 15:02
@hjmjohnson
hjmjohnson force-pushed the ci/build-all-codepaths branch from 22e1814 to f3cd98c Compare October 14, 2026 19:18
Base automatically changed from ci/build-all-codepaths to master November 5, 2026 19:43
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.
@hjmjohnson

Copy link
Copy Markdown
Member Author

@greptileai review

@hjmjohnson
hjmjohnson marked this pull request as ready for review November 8, 2026 16:51

@gdevenyi gdevenyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. [CRITICAL BLOCKER] 12-hour polling loop on every push to master (cmake/github_dashboard.cmake:55-62 + cmake/nifti_common.cmake:358-360, 453-458):
    • Fixing if(NOT "$ENV{SYSTEM_PULLREQUEST_SOURCEBRANCH}" STREQUAL "") means a push to master now enters elseif("$ENV{BUILD_SOURCEBRANCHNAME}" STREQUAL "master") and sets dashboard_model = "Continuous".
    • In cmake/nifti_common.cmake:358-360, when dashboard_model STREQUAL "Continuous" and dashboard_loop is unset, nifti_common.cmake sets dashboard_loop = 43200 (12 hours) and loops while(NOT dashboard_done) sleeping 300s between iterations!
    • This never ran on the PR (Experimental), so merging #89 as-is will hang all 5 Build and Test jobs (4 Linux + 1 macos-latest) until GitHub Actions' 6-hour job timeout on every commit to master!
    • Fix: Set set(dashboard_loop 0) and set(dashboard_no_update 1) in cmake/github_dashboard.cmake (the latter also prevents ctest_update() from running git pull origin <pr_branch>, which fails on fork PRs).
  2. Merge order with #90: #89 carries 3 prototype/linkage commits (3312236, 5b001ae, 6bc54a4) that overlap #90 (after #90 resolves axml_recur_find_xml). Landing #90 first and rebasing #89 keeps symbol/prototype changes in one place.
  3. Dead code hunk in cmake/nifti_common.cmake:270-273, shell robustness in cmake/collect_exported_symbols.sh, and lost NIFTI_PACKAGE_PREFIX / INTERPROCEDURAL_OPTIMIZATION coverage in build.yml (details inline).

Comment thread cmake/github_dashboard.cmake Resolved
Comment thread cmake/nifti_common.cmake Resolved
Comment thread cmake/collect_exported_symbols.sh Resolved
# 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Google Carbon] Heads-up on two coverage gaps in this matrix:

  1. install_linking (enabled by shared=ON) currently does not actually test the installed NIFTIConfig.cmake: install_linking_test.sh:37 passes -DCMAKE_MODULE_PATH=../installed/usr/local/share (wrong path) and GIT_REPO_VERSION is 0.0.0.0 (no tags on this repo), so find_package(NIFTI 3) fails in minimal_example_of_downstream_usage and silently falls back to FetchContent git clone-ing upstream NIFTI-Imaging/nifti_clib over the network!
  2. Removing options: [default, all] means no CI job builds the default out-of-the-box cmake -B build configuration (USE_NIFTI2_CODE=ON, USE_NIFTICDF_CODE=ON, USE_CIFTI_CODE=OFF, USE_FSL_CODE=OFF).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/build.yml Resolved
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.
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.

3 participants