Continuous Integration
Every pull request and every push to the long-lived branches is checked by GitHub Actions. The workflow files are in
.github/workflows/. This page explains what runs when, how to run the same checks on your own machine, why a job
can be slow or red for reasons that have nothing to do with your change, and what to keep in mind when you edit a
workflow.
How the CI is organised
Three conventions apply to almost every workflow:
A job named
changesdecides whether the heavy jobs run. It compares the files of the pull request with a path filter, so a pull request that only touches documentation does not start the C++ builds.A gate job reports the result.
ci-build-gate,lint-gate,cpp-check-gate,clang-format-gateandlicense-check-gatefail if one of their jobs failed and pass if the jobs passed or were skipped. A skipped job is therefore not a missing check.A release pull request skips the checks that judge the whole diff. A pull request from a
release/*branch contains every change since the last release, all of which passed these checks on itsdevpull request. LINT (800+ files, one after the other: killed after half an hour), the DevOps C++ Check (fails on vendored files in the diff), the Performance Gate (compares with the previous release and reports the sum of a cycle:kinetics+29 %) and the Clang Build do not run on it, nor does the check for a linked issue (the release pull request closes no issue of its own). BUILD, Clang Format, License Header, the changelog checks and the docs still do. A hotfix is not skipped: its diff is small.Only superseded pull request runs are cancelled. Pushing to a pull request branch cancels the older run of the same workflow. Runs for pushes to
devandmain, the nightly run and manual runs each get their own concurrency group and are never cancelled, because they give the verdict for a commit and fill the cache of the branch.
Workflows
Workflow |
File |
Runs on |
What it checks |
|---|---|---|---|
BUILD |
|
pull requests (any base branch), pushes to |
Builds and tests the project. See the BUILD jobs below. |
LINT |
|
pull requests (any base branch), pushes to |
|
DevOps C++ Check |
|
pull requests to |
|
Clang Format Check |
|
pull requests to |
Every changed C++ file must be clean under clang-format 20.1.3, as a whole file, not only the changed lines. |
License Header Check |
|
pull requests (any base branch), pushes to |
The exact GPL header of |
Changelog Fragment Check |
|
pull requests to |
Runs the tests of the scripts in |
Check PR Has Linked Issue |
|
pull request events, manual |
The description or title contains |
Performance Gate |
|
pull requests to |
Builds |
Clang Build |
|
pull requests that touch C++ or build files |
Not a gate. Builds and tests the project with clang 20 to keep it building with clang. Pull requests use
ccache and a unity build (16 files per compiler call, about 40 % faster when a header changes); a push to
|
Docs |
|
pull requests to |
Builds the Sphinx and Doxygen documentation; a push to |
Sync dev → NEXT |
|
pushes to |
Merges |
Sync main → dev |
|
pushes to |
Merges |
Create Release PR, Release Lifecycle |
|
manual; pull requests to |
The release process, see Branches and Releases. |
Dismiss Stale Approvals |
|
new commits on pull requests to |
Dismisses approvals when the new commits contain more than a merge of |
PQ Bot Coworker, PQ Bot Review |
|
comments on issues and pull requests |
The PQ Bot. |
The BUILD jobs
build: a matrix of x86_64 and arm, each as Release and as Debug, built with Ninja. The Debug build on x86_64 also measures the test coverage (gcovr). The Release builds run the integration tests (see below). The Debug builds use the strict warning set with-Werror, and the arm Debug job also builds thebenchmarks/perfand Google Benchmark sources, so that they are held to the same warnings.
benchmark: runs the Google Benchmark suite as a smoke test.
build-static-lto: a static build with link-time optimisation. Its tests only run in the nightly run, which buildsmain.
static-singularity-build: only in the nightly and manual runs.
mpi-build: builds with MPI and runs the tests.
python-bindings: buildsPQwithBUILD_WITH_PYTHON_BINDINGS=ONand runs thetestPQClitest, which compares the capabilities thatPQreports with the configuration.
The integration tests run on both the x86_64 and the arm Release build on purpose (decided in issue #706):
dftbplus, xtb and pyscf come from architecture-specific conda-forge packages, so the arm run exercises
different binaries. It costs no wall-clock time, because the arm Release job is not the slowest job.
Running the checks locally
The checks that fail most often can be run before you push:
Check |
How to run it |
|---|---|
Build and unit tests |
$ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_NATIVE=OFF
$ cmake --build build --parallel
$ ctest --test-dir build --output-on-failure
Use the compiler version of |
clang-format |
|
License header |
|
DevOps C++ checks |
See the setup on the static checks page. |
clang-tidy |
|
Changelog fragment |
$ python3 scripts/check_changelog_fragment.py origin/dev HEAD
The check looks at committed changes, so commit the fragment first. |
Tests of the scripts |
$ python3 -m unittest discover -s scripts/tests -p 'test_*.py'
|
Documentation |
$ cmake -S . -B build -DBUILD_WITH_DOCS=ON -DBUILD_WITH_ASE=OFF -DBUILD_WITH_TESTS=OFF -DPQ_DOXYGEN_GRAPHS=OFF
$ cmake --build build --target sphinx-docs
This needs |
Timing comparison
Instruction counts cannot see memory bound code, system calls or file I/O, so scripts/perf_timing.py also compares
the CPU time of the measured loop of every benchmark with the one of the base. Both are built and run in the same job.
The time comes from libperf_timer.so (benchmarks/perf/timer), preloaded in a plain run: it measures from the
perfAllocBegin() marker to the end of the process, so startup and setup are not part of it.
A timing on a shared runner is noisy, so the script does not compare two numbers:
Copies. Byte-identical copies of a binary run at different speeds (4 to 7 % for allocation heavy code in a test: where the file lies in the page cache). Every benchmark is therefore run from 4 copies of the base and 4 copies of the pull request binary. Their spread is the layout noise and widens the interval.
Interleaved and pinned. Every round runs all copies in a random order on one CPU, without address space randomisation, with an empty environment and from paths of the same length.
An interval, not a number. The change is the median of the paired ratios with a 95 % bootstrap interval over the rounds, plus the layout noise.
A clear criterion. A regression needs the whole interval above the threshold (10 %). It is then measured again with more rounds, and only that second measurement decides. If the layout noise alone exceeds the threshold the benchmark is shown as noisy (⚠️) and not judged. Loops shorter than 2 ms (the median of three runs) are listed, not timed.
$ python3 scripts/perf_timing.py build-pr/benchmarks/perf build-base/benchmarks/perf # needs libperf_timer.so there
$ python3 scripts/perf_timing.py PR BASE --threshold 5 --rounds 21 --copies 6 --report-only
Comparing a build with a copy of itself is the way to see the noise of a machine: it must report no regression, and a
benchmark the script cannot judge shows up as noisy. If the check ever fails without a change of yours, run the
benchmark again in the job log; to only report, add --report-only to the step in perf.yml.
Caches and speed
A job that takes twice as long as usual is rarely a problem in your change. These are the effects to look at first:
ccache. Every build job keeps a ccache per job and branch scope.
CCACHE_SLOPPINESS=pch_defines,time_macrosis set, because without it ccache cannot cache compiles that use a precompiled header (about two thirds of all compiler calls were uncacheable before, issue #732). The Debug and the lint caches are allowed 1.5 GB, the others 500 MB; a cache that is at its limit evicts what the next build needs.A header change is a cold cache. Touching a header that most files include recompiles most files. The x86_64 Release job went from about 2.5 to 9 minutes for a pull request that changed
exceptionTypes.hpp. The same is true for your local build, see Local Build Times.The runner CPU. GitHub gives the same job runners of different CPU generations. The same fixed compile took 4.8 to 5.1 s on an AMD EPYC 9V45 and 7.3 to 8.7 s on an EPYC 7763.
A stalled or slow apt install. Installing GCC or clang normally takes 6 to 20 s, but the Azure mirror sometimes stalls or crawls: the step took 13 to 34 minutes on about one run in ten (#1069). The
setup-gccaction, the clang build and the DevOps check therefore install throughawalsh128/cache-apt-pkgs-action, which caches the.debfiles per package list: a hit downloads nothing, only a miss (a changed package list, or the first run in a branch scope) goes to the mirror. Bumpversionthere to drop the cached packages. If a job still sits in an install step, cancel and re-run it.The clang job: ccache and unity. Pull requests build with ccache (the job took 8 to 17 minutes, depending on the CPU of the runner, #1045). A push to
devignores the cache for reading (CCACHE_RECACHE) and writes it. The build passes-Xclang -fno-pch-timestamp: without it clang puts the date of the precompiled header into the.pchfile and every compile is a ccache miss. Pull requests also build in unity batches of 16 source files (CMAKE_UNITY_BUILD): most of the compile time is mp-units template instantiation, which a batch does once instead of once per file. A clean build on 4 cores took 451 to 487 s, with batches of 8 324 s and with batches of 16 283 s, with the same test results (#1088). A unity build can hide a missing#include, so a push todevstays a normal build, and the GCC jobs, which gate, are not unity builds.The Eigen source is cached under a key that hashes
.cmake/eigen.cmakeand passed to CMake with-DFETCHCONTENT_SOURCE_DIR_EIGEN, so that no job clones it again.The conda environment of the integration tests is cached under a key that hashes
ci_build.yml. Every edit of that file, even a comment, makes the next run install the environment from scratch on both architectures. Keep that in mind before you touch it, and prefer to document a decision elsewhere.The cache limit. The repository’s Actions cache is limited to 10 GB and the oldest entries are evicted. Each pull request saves its own ccache entries, which only that pull request can read.
When a job fails without a reason
A job that sits in the queue and is cancelled after about 15 minutes, with no runner assigned and no steps, was never started: the runner pool or GitHub Actions had a problem (check https://www.githubstatus.com). Re-running does not help during such an outage and does not need a code change; re-run the failed jobs once Actions has recovered. A job that did start and fails is a real result, even if it looks unrelated: read its log first.
Adding or changing a workflow
Follow the pattern above: a
changesjob, the heavy jobs depending on it, and a gate job withif: always().
scripts/tests/test_workflow_path_filters.pyfails if adorny/paths-filterfilter contains a negated pattern: the patterns of a filter are ORed, and a negated pattern on its own matches every other file.Workflows that need a write token mint one from a GitHub App (
actions/create-github-app-token, pinned by commit). Check which apps are installed on the organisation before you rely on a secret: the sync workflow used an app that was not installed and its token step failed with “Not Found” (issue #804). Today the release bot and the performance bot are installed.A push made with the default
GITHUB_TOKENdoes not start other workflows. A branch that has to trigger CI needs a token of a GitHub App.Prefer the shared actions in
.github/actions:setup-gccinstalls the pinned GCC once for all workflows.