FairShip ships a comprehensive test and CI pipeline that covers everything from C++ unit tests to end-to-end physics simulation chains. All of these steps are reproducible locally throughDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ShipSoft/FairShip/llms.txt
Use this file to discover all available pages before exploring further.
pixi run tasks, so you can catch failures before pushing and understand exactly what GitHub Actions does when it evaluates your pull request. The tasks are defined in pixi.toml and mirror the steps in the .github/workflows/build-run.yml workflow, ensuring there is no gap between what runs locally and what runs in CI.
Pre-commit style checks run on a separate CI service. See the live status badge at results.pre-commit.ci/latest/github/ShipSoft/FairShip/master. These checks run automatically on every pull request; you can also run them locally with
pre-commit run --all-files.Build Tasks
Before running tests or CI tasks, the project must be configured, built, and optionally installed. These foundational pixi tasks are defined inpixi.toml:
| Task | Command | Description |
|---|---|---|
configure | cmake -S . -B build -G Ninja … | Runs CMake configuration, generates build/compile_commands.json for clang-tidy |
build | cmake --build build -j$(nproc) | Compiles FairShip (depends on configure) |
install | cmake --install build | Installs built libraries and executables into $CONDA_PREFIX (depends on build) |
test | ctest --test-dir build --output-on-failure | Runs the CTest suite (depends on build) |
Unit Tests
The C++ unit test suite lives in thetests/ directory and is built and run via CTest:
ctest --test-dir build --output-on-failure, which prints the full output of any failing test. The build task is a dependency, so if the build is stale it will be rebuilt automatically.
Full Simulation Chain
The CI simulation chain reproduces the complete SHiP analysis pipeline: geometry setup, simulation, overlap checking, reconstruction, and analysis. Each step is an independentpixi run task that reads the output files of the previous step by tag name. The sim-chain tasks use the tag ci-test.
Simulate events
Run the simulation with the This calls
Override arguments like this:
TRY_2025 muon shield, vacuum vessel geometry, and all SND designs:macro/run_simScript.py and produces sim_ci-test.root and geo_ci-test.root. The task accepts optional arguments to override defaults:| Argument | Default | Description |
|---|---|---|
vessel | vacuums | Vessel geometry variant |
snd_design | all | SND detector design |
muon_shield | TRY_2025 | Muon shield configuration name |
Check geometry overlaps
Validate the geometry for unintended volume overlaps:Runs
python/experimental/check_overlaps.py against geo_ci-test.root and fails the task if any overlap is detected in the log.Reconstruct events
Run digitisation and reconstruction on the simulated events using the Artificial Retina pattern recognition:Produces
sim_ci-test_rec.root containing digitisation and reconstruction branches. The original simulation file is not modified.Produce analysis histograms
Run the standard analysis macro over both simulation and reconstruction output:
Additional CI Tasks
Tracking Benchmark
Evaluates tracking performance on 200 simulated events with a fixed seed, producing a JSON metrics file:Runs with
-n 200 --seed 42 --tag ci-benchmark --output-json tracking_metrics.json. Output files use the ci-benchmark tag.Fixed-Target Neutrino Simulation
Runs the fixed-target neutrino simulation for 10 events:Calls
macro/run_fixedTarget.py -n 10 -e 10.0 -r 1.Plot Rendering
After running the simulation chain or benchmarks, render diagnostic plots to PNG using the dedicated rendering tasks. Plots are written to subdirectories underplots/.
config argument (default pixi-default) that determines the subdirectory name under plots/sim-chain/.
Static Analysis
Static analysis tasks take file lists through environment variables so you can target only the files you have changed, mirroring exactly how the CI workflow passes file lists.- C++ (clang-tidy)
- Python (pyrefly)
Set The task pipes clang-tidy output through
CPP_FILES to a space-separated list of C++ source files and run:.github/scripts/annotate_build.py, which formats diagnostics as GitHub Actions annotations when running in CI. Locally you see the raw clang-tidy output.CI Output File Naming
The pipeline relies on consistent file naming so each step can find the previous step’s output without configuration:| Task group | Tag used | Example output file |
|---|---|---|
| Simulation chain | ci-test | sim_ci-test.root, geo_ci-test.root, sim_ci-test_rec.root |
| Tracking benchmark | ci-benchmark | tracking_benchmark_histos.root, tracking_metrics.json |
--tag, update downstream task invocations accordingly or use the pixi task arguments to override the defaults.