.. _continuousIntegration: ###################### 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** ``changes`` **decides 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-gate`` and ``license-check-gate`` fail 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 its ``dev`` pull 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 ``dev`` and ``main``, 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 ********* .. list-table:: :header-rows: 1 :widths: 18 18 24 40 * - Workflow - File - Runs on - What it checks * - BUILD - ``ci_build.yml`` - pull requests (any base branch), pushes to ``dev``, ``main`` and ``NEXT``, nightly at 02:00 UTC, manual - Builds and tests the project. See :ref:`the BUILD jobs ` below. * - LINT - ``lint.yml`` - pull requests (any base branch), pushes to ``dev``, ``main`` and ``NEXT``, manual - ``clangd-tidy`` on the changed C++ files (``scripts/clang_tidy.sh``). The job builds the project first, tolerating compile errors, only to get a compile database. It is skipped for release pull requests (``release/*``) and for pushes to ``main``: these contain every change since the last release, which was linted on its ``dev`` pull requests, and one serial run over 800 files does not finish. A hotfix is linted on its own pull request. * - DevOps C++ Check - ``devops_cpp_check.yml`` - pull requests to ``main``, ``dev`` and ``NEXT``, manual - ``cpp_checks`` from ``external/devops``: style and AST rules, see :doc:`staticChecks`. * - Clang Format Check - ``clang_format.yml`` - pull requests to ``main``, ``dev`` and ``NEXT``, manual - 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 - ``license_check.yml`` - pull requests (any base branch), pushes to ``main``, manual - The exact GPL header of ``config/licenseHeader.txt`` in every C++ file. * - Changelog Fragment Check - ``changelog.yml`` - pull requests to ``dev`` and ``NEXT`` - Runs the tests of the scripts in ``scripts/tests`` and requires a valid changelog fragment, see :ref:`changelogFragments`. A pull request with the label ``skip-changelog`` needs no fragment (the tests of the scripts still run); adding or removing the label re-runs the check. * - Check PR Has Linked Issue - ``gh_checks.yml`` - pull request events, manual - The description or title contains ``Closes #N``, ``Fixes #N``, ``Resolves #N`` or ``Related to #N`` (or the pull request has an issue linked in GitHub). A phrase such as "Part of #N" is *not* recognised. * - Performance Gate - ``perf.yml`` - pull requests to ``main``, ``dev`` and ``NEXT`` that touch C++ or build files; nightly - Builds ``benchmarks/perf`` for the pull request and its base, runs both under ``callgrind`` and fails if an instruction count grew beyond the threshold. Instruction counts are deterministic, so this check is not flaky. The comment also lists the heap allocations of the measured loop (exact; a rise fails the check as well), the peak heap in use (exact, report only; bytes per molecule for the size series) and the cache misses and branch mispredictions of a simulated 32 KiB L1 cache, 8 MiB last level cache and branch predictor (report only). The simulated numbers depend only on the binary, not on the machine, but on the program path and the environment, so the gate runs every binary through a path of the same length with an empty environment. The simulation makes the runs about three times slower, so pull requests skip it (``PERF_CACHE_SIM=0``); a nightly run (03:00 UTC, ``dev`` against ``dev`` of a day earlier, also available as a manual run) keeps it on and writes the table to the job summary. A second step compares the CPU time of the measured loop of both builds on the same runner, see :ref:`perfTiming`; a confirmed slowdown fails the check. * - Clang Build - ``clang_build.yml`` - 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 ``dev`` compiles every file on its own and refreshes the cache. * - Docs - ``jekyll-gh-pages.yml`` - pull requests to ``main`` and ``dev`` that touch ``docs``, ``include`` or ``src``; pushes to ``main`` - Builds the Sphinx and Doxygen documentation; a push to ``main`` also deploys the website. * - Sync dev → NEXT - ``sync-dev-into-next.yml`` - pushes to ``dev``, daily at 03:00 UTC, manual - Merges ``dev`` into ``NEXT``. On a conflict it opens a pull request from a ``merge/dev-into-NEXT-