Improve python bindings #256
Workflow file for this run
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}} | |
- 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 | |
$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 | |
env: | |
CTEST_OUTPUT_ON_FAILURE: true | |
- name: Upload Unit Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Results (${{ runner.os }}, ${{matrix.simd}}, enable_fitting=${{matrix.enable_fitting}} ) | |
path: xml | |
- name: Models tests | |
run: | | |
if [[ ${{matrix.enable_fitting}} == "OFF" ]] ; then | |
export AMPGENROOT=$PWD | |
export PYTHONPATH=$PWD/python:$PYTHONPATH | |
export PATH=$PATH:$PWD/build/bin | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/build/lib | |
for x in test/model/*.opt ; do | |
name=$(basename $x) | |
timeout -s SIGSEGV 60 pytest -sq test/python/test_model.py --model $x --junit-xml=${name}-${{matrix.simd}}-${{matrix.enable_fitting}}-${{runner.os}}.xml | |
done | |
fi | |
- name: upload model test results | |
if: always() | |
uses: pmeier/pytest-results-action@main | |
with: | |
path: | | |
*.xml | |
summary: true | |
fail-on-empty: false | |
title: Model results (${{ runner.os }}, ${{matrix.simd}}, enable_fitting=${{matrix.enable_fitting}} ) | |
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 |