Skip to content

refactor(ci): ♻️ make the justfile the single source of build commands - #326

Merged
robertodr merged 7 commits into
mainfrom
refactor/ci-justfile-single-source
Sep 2, 2026
Merged

refactor(ci): ♻️ make the justfile the single source of build commands#326
robertodr merged 7 commits into
mainfrom
refactor/ci-justfile-single-source

Conversation

@robertodr

@robertodr robertodr commented Sep 1, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Summary

The workflows kept their own copies of commands a developer also runs: five dependency installs, four uv sync spellings, the build-info dump, the sanitizer option sets, the MPI oversubscription variables, the CTest label filters, the rank loop, a 70-line find_package consumer heredoc, and a second set of link-checker flags. They drifted, and a failing lane could not be reproduced locally without transcribing YAML. This makes the justfile the single source of truth for commands; workflows choose matrices, environment and artifacts. No library code changes.

Changes

  • .github/actions/setup: installs just and uv (cache keyed per build configuration) and the system packages. Replaces the dependency block in eight jobs.
  • tools/packages/{apt,apt-mpi,brew,brew-mpi}.txt: the package lists as data, read by the action and by .devcontainer/Dockerfile (which installs just itself, so it can share the data but not a recipe). The compiler package is derived from CXX, so a matrix lane carries no list of its own.
  • just build *ARGS is the only uv sync for the package, spelled once in the uv_sync variable. just info replaces the build-info heredoc.
  • monoprop_ENABLE_MPI is now the only MPI switch: C++ build, mpi4py build requirement, mpi runtime extra, and the MPI packages CI installs. Serial builds drop the extra, since import mpi4py.MPI raises with no runtime.
  • Test legs as recipes: test-py, test-cpp, test-cpp-mpi, test-py-mpi, plus test-cpp-asan, test-py-asan, sanitizer-reports, test-cpp-tsan. test, test-wide and test-mpi are build bodies with dependencies on those legs.
  • build_dir follows SKBUILD_CMAKE_BUILD_TYPE, so a sanitizer or coverage tree is found through the environment that built it. The two oversubscription variables are exported once instead of four times.
  • cpp/tests/find_package_smoke/ is a tracked standalone project, run by just test-find-package, replacing the consumer program test.yml wrote inline. It compiles the in-tree link_export_probe source, so the exercised consumer and the in-tree probe cannot drift, and it links only monoprop::monoprop, as a downstream user does.
  • The link checker's options live in .lychee.postbuild.toml, read by both just check-doc-links and the docs workflow. The recipe's --index-files turned out to be the wrong half of that drift: it made lychee demand an index inside the asset directory the export writes beside each page instead of falling back to the page.
  • tools/check-workflow-commands.py, a prek hook, fails any workflow step whose run: block invokes the build, test, coverage or packaging tools directly. Version probes are exempt; the deliberate exceptions carry a reason and are keyed by step name, so an entry matching no step is itself an error.
  • Two behavior changes: the legs run --no-sync, so a test run cannot silently rebuild a differently configured wheel; and the serial Python leg drops -m "not mpi", which pytest-mpi already skips without --with-mpi (what CI relied on).
  • One drive-by fix: the setup action used mapfile and ${var,,}, neither of which exists in the bash 3.2 the macOS runners ship.
  • Docs updated in step: AGENTS.md, README.md, cpp/tests/README.md, docs/content/docs/{building,testing,how-to-contribute}.mdx, including a stale reference to a just test-mpi-matrix recipe that never existed.

qa-analysis.yml's clang-tidy invocation and deploy.yml's packaging commands are deliberately left in the workflows, as recorded exceptions.

Checklist

  • Tests added or updated to cover the changes
  • Documentation updated (docstrings, docs/, CONTRIBUTING.md) if needed
  • CHANGELOG / release notes updated if applicable

AI/LLM disclosure

  • I used the following tool to help write this PR description: Pi (claude-opus-5)
  • I used the following tool to generate or modify code: Pi (claude-opus-5)

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci tools labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Docs preview: https://pr-326.monoprop-docs.pages.dev

@github-actions github-actions Bot added the cpp label Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.70%. Comparing base (89a9603) to head (e9f4ac9).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #326   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          14       14           
  Lines         742      742           
  Branches       98       98           
=======================================
  Hits          725      725           
  Misses         12       12           
  Partials        5        5           
Flag Coverage Δ
cpp 97.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@robertodr
robertodr force-pushed the refactor/ci-justfile-single-source branch 2 times, most recently from b6aaa2c to 8bfe617 Compare September 2, 2026 06:31
@robertodr
robertodr marked this pull request as ready for review September 2, 2026 06:32
@robertodr
robertodr requested review from matteoacrossi and removed request for diagonal-hamiltonian and fpietra September 2, 2026 06:33
Workflows kept their own copies of the dependency install, the uv sync, and
the build-info dump, which had drifted into five package lists and four sync
spellings. A composite setup action now bootstraps just and uv and installs
from the shared package lists, and every job builds through `just build`.

Assisted-by: Pi:gpt-5.6-sol
Every test leg was spelled out in a workflow step: the sanitizer option sets,
the MPI oversubscription variables, the ctest label filters and the rank loop.
The legs are recipes now, so a developer runs what CI runs.

The legs use --no-sync, so a test run cannot rebuild a differently configured
wheel, and the serial Python leg drops -m "not mpi", which pytest-mpi already
skips without --with-mpi.

Assisted-by: Pi:gpt-5.6-sol
The find_package(monoprop) check was a heredoc that wrote a CMake project and a
main.cpp into the runner, so it could not be run locally and its API exercise
had already drifted from the in-tree link-export probe.

It is a tracked standalone project now, compiling the probe's source so the
in-tree and external consumers cannot diverge. That also compiles the probe's
explicit instantiations against the installed headers.

Assisted-by: Pi:gpt-5.6-sol
The recipe and the docs workflow passed lychee different flags, so the check a
contributor ran was not the check CI ran. The flags live in
.lychee.postbuild.toml now, which both read. lychee resolves a relative root_dir
against the working directory, so the config needs no absolute path.

The recipe was the wrong one of the two: its --index-files made lychee demand an
index inside the asset directory the export writes beside each page, rather than
fall back to the page itself. The config drops it.

The workflow keeps calling lychee through its action: the runner images carry no
lychee package.

Assisted-by: Pi:gpt-5.6-sol
The macOS runners still ship bash 3.2, where mapfile does not exist and the
${var,,} expansion is a syntax error, so every macOS lane failed in the setup
action before it built anything.

Assisted-by: Pi:gpt-5.6-sol
A command pasted back into a run: block works until it drifts from the recipe
it duplicates, and then a failing lane cannot be reproduced locally. Nothing
caught that. The hook fails a workflow step that runs the build, test, coverage
or packaging tools directly.

Version probes are exempt, and the deliberate exceptions carry a reason. They
are keyed by step name, and an entry matching no step is an error, so renaming
an exempt step forces its exception to be reconsidered.

Assisted-by: Pi:gpt-5.6-sol
@robertodr
robertodr force-pushed the refactor/ci-justfile-single-source branch from 8bfe617 to 9eb9f30 Compare September 2, 2026 06:44

@diagonal-hamiltonian diagonal-hamiltonian 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.

Approve, but needs a comment sweep

Comment thread .lychee.postbuild.toml Outdated
Comment thread cpp/tests/find_package_smoke/CMakeLists.txt Outdated
Comment thread .github/workflows/docpages.yml Outdated
Comment thread cpp/tests/find_package_smoke/CMakeLists.txt Outdated
Comment thread cpp/tests/find_package_smoke/CMakeLists.txt Outdated
Comment thread cpp/tests/README.md Outdated
Comment thread tools/packages/apt-mpi.txt Outdated
Comment thread tools/packages/apt.txt Outdated
Comment thread .lychee.postbuild.toml Outdated
Comment thread justfile Outdated
Comment thread justfile Outdated
Comment thread justfile Outdated
Comment thread justfile Outdated
Comment thread justfile Outdated
Comment thread justfile
Comment thread justfile Outdated
Co-authored-by: Roberto Di Remigio Eikås <robertodr@users.noreply.github.com>
Signed-off-by: Roberto Di Remigio Eikås <robertodr@users.noreply.github.com>
@robertodr
robertodr enabled auto-merge (squash) September 2, 2026 08:12
@robertodr
robertodr merged commit 21c0d13 into main Sep 2, 2026
26 checks passed
@robertodr
robertodr deleted the refactor/ci-justfile-single-source branch September 2, 2026 08:15
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci cpp documentation Improvements or additions to documentation tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants