Skip to content

tests: update nist and ge validation #2350

tests: update nist and ge validation

tests: update nist and ge validation #2350

Workflow file for this run

name: Build & Test
on:
push:
branches:
- main
- "releases/**"
paths-ignore:
- "**.md"
pull_request:
release:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test_on_linux:
name: Test on remage image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container_version:
- latest
- stable
- slim
container: docker://legendexp/remage-base:${{ matrix.container_version }}
steps:
- uses: actions/checkout@v6
with:
# we need a fully checked-out repo to get version from setuptools-scm.
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.ref }}
- name: Build project
shell: bash # make the pipes to tee below propagate errors (pipefail is on by default).
run: |
git config --global --add safe.directory $(pwd) # make git work inside container.
# install some tools for more efficient disk space usage.
pip install uv setuptools-scm
mkdir build
cd build
cmake -DBUILD_TESTING=ON -DRMG_BUILD_DOCS=OFF .. | tee -a build.log
make -j$(nproc) | tee -a build.log
make install | tee -a build.log
- name: post-build cleanup
shell: bash
run: |
echo "freeing some disk space..."
echo "free space before: $(df --output=avail -h -- $(pwd) | tail -n1)"
uv cache clean
pip cache purge
echo "free space after: $(df --output=avail -h -- $(pwd) | tail -n1)"
- name: check version equality
run: |
cd build
cpp_version=$(sed -En "s/-- remage version [0-9.]+ \(([0-9a-z.+_-]+)\)/\\1/p" build.log)
py_version=$(sed -En "s/-- Installed python wrapper Version: ([0-9a-z.+_-]+)/\\1/p" build.log)
if [ "$cpp_version" != "$py_version" ]; then
echo "::error::version numbers of python wrapper ($py_version) and cpp executable ($cpp_version) differ!"
exit 1
fi
- name: Compare checked-in doc dump with current result
if: ${{ matrix.container_version == 'stable' }}
run: |
cd build
cp ../docs/rmg-commands.md ../docs/rmg-commands.md.bak
echo "::group::compile and run remage-doc-dump"
make remage-doc-dump
echo "::endgroup::"
docs_differ=0
docs_diff=$(diff -u ../docs/rmg-commands.md ../docs/rmg-commands.md.bak) || docs_differ=$?
if [ $docs_differ -ne 0 ]; then
echo "::error file=docs/rmg-commands.md::docs/rmg-commands.md is not up-to-date with remage source. please run 'make remage-doc-dump' and commit changes."
echo "$docs_diff"
exit 1
fi
- name: Run full test suite
if: ${{ matrix.container_version != 'slim' }}
run: |
cd build
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
ctest --label-exclude 'mt|val-only' -j$(nproc) --output-on-failure
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
ctest --label-regex mt --label-exclude val-only -j1 --output-on-failure
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
- name: Upload test suite outputs to GitHub
if: ${{ always() && matrix.container_version != 'slim' }}
uses: actions/upload-artifact@v7
with:
name: remage-test-output-g4flavor-${{ matrix.container_version }}
# artifacts must have a ".output*" extension
path: build/tests/**/*.output*.*
- name: Run minimal test suite
if: ${{ matrix.container_version == 'slim' }}
run: |
cd build
ctest --label-exclude 'extra|vis|mt|val-only' -j$(nproc) --output-on-failure
ctest --label-regex mt --label-exclude 'extra|vis|val-only' -j --output-on-failure
- name: Test docs building
if: ${{ matrix.container_version != 'slim' }}
run: |
cd build
cmake -DRMG_BUILD_DOCS=ON ..
make sphinx
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
- name: Minimally test installed executable
run: |
rm -rf build
export PATH="/usr/local/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
REMAGE_ASSERT_CPP_ORIGIN="config" remage --version
test_on_mac:
name: Test on macOS
runs-on: macos-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v6
with:
# we need a fully checked-out repo to get version from setuptools-scm.
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.ref }}
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: "geant4-env"
auto-activate-base: "false"
channels: conda-forge
channel-priority: "strict"
conda-remove-defaults: "true"
- name: Install Geant4 and native dependencies
run: |
# native dependencies for pyg4ometry
brew update
brew install opencascade cgal gmp mpfr boost
conda install conda-forge::geant4 conda-forge::bxdecay0 "conda-forge::python<3.14"
echo "CMAKE_PREFIX_PATH=$CONDA_PREFIX" >> $GITHUB_ENV
- name: Build project
run: |
mkdir build
cd build
cmake \
-D CMAKE_INSTALL_PREFIX=../local \
-D Python3_EXECUTABLE="$(command -v python)" \
-D BUILD_TESTING=ON \
-D RMG_BUILD_DOCS=OFF \
..
make -j$(nproc)
make install
- name: Run full test suite
run: |
cd build
ctest --label-exclude 'mt|val-only' -j$(nproc) --output-on-failure
ctest --label-regex mt --label-exclude val-only -j1 --output-on-failure
- name: Minimally test installed executable
run: |
rm -rf build
export PATH="$PWD/local/bin:$PATH"
export DYLD_FALLBACK_LIBRARY_PATH="$PWD/local/lib:$CONDA_PREFIX/lib:$DYLD_FALLBACK_LIBRARY_PATH"
REMAGE_ASSERT_CPP_ORIGIN="config" remage --version
# vim: expandtab tabstop=2 shiftwidth=2