modernise CMakeLists.txt slightly #221
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- v* | |
pull_request: | |
branches: | |
- master | |
env: | |
CACHE_NUMBER: 0 | |
jobs: | |
build-and-test: | |
name: build-and-test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
simd: [0, AVX2d] | |
enable_fitting : [ON, OFF] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
clean: false | |
- name: Setup MiniForge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: MiniForge3 | |
miniforge-version: latest | |
activate-environment: my-env | |
use-mamba: true | |
- name: load cache | |
uses: actions/cache@v4 | |
with: | |
path: /usr/share/miniconda3/envs/my-env | |
key: ubuntu-latest-conda-${{ hashFiles('.github/etc/env.yml') }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -n my-env -f .github/etc/env.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Configure | |
run: cmake -S . -B build -DENABLE_INSTALL=0 -DUSE_SIMD=${{matrix.simd}} -DENABLE_FITTING=${{matrix.enable_fitting}} -DENABLE_TEST=${{matrix.enable_fitting}} | |
- name: Build | |
run: cmake --build build -j "$(getconf _NPROCESSORS_ONLN)" | |
- name: Run | |
run: ./build/bin/AmpGen options/example_b2kstarll.opt --CompilerWrapper::Verbose --nEvents 10000 | |
- name: Fit | |
run: | | |
./build/bin/AmpGen options/example_kspipi.opt --nEvents 100000 --Output KsPiPi.root | |
if [[ ${{matrix.enable_fitting}} == "ON" ]] ; then | |
./build/bin/SignalOnlyFitter options/example_kspipi.opt --DataSample KsPiPi.root | |
fi | |
env: | |
CTEST_OUTPUT_ON_FAILURE: true | |
- name: Unit tests | |
run: | | |
mkdir xml | |
for x in build/bin/test/test_*; do | |
name=$(basename $x); $x --log_level=all --log_format=JUNIT > xml/${name}.xml | |
sed -n '/^<?xml version="1.0" encoding="UTF-8"?>$/,$p' xml/${name}.xml > xml/${name}.xml-i | |
mv xml/${name}.xml-i xml/${name}.xml | |
done | |
- name: Upload Unit Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Results (${{ runner.os }}) | |
path: xml | |
publish-test-results: | |
name: "Publish Unit Tests Results" | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
# the build-and-test job might be skipped, we don't need to run this job then | |
if: success() || failure() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: check files | |
run: find . -name '*.xml' | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: artifacts/**/*.xml |