Complete final missing PyInterface
and make tests more Robust
#1903
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: Rust | |
on: | |
push: | |
branches-ignore: | |
- pycli | |
- bump-pyo3-version | |
defaults: | |
run: | |
shell: bash | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: ghcr.io/nnpdf/pineappl-ci:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get test data | |
id: cache-test-data | |
uses: actions/cache@v4 | |
with: | |
path: test-data | |
key: test-data-v14 | |
- name: Download test data | |
if: steps.cache-test-data.outputs.cache-hit != 'true' | |
run: | | |
test -d test-data || mkdir test-data | |
cd test-data | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/ATLASWPT11-Wplus_tot.appl' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/CMS_TTB_8TEV_2D_TTM_TRAP_TOT-opt.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/CMS_TTB_8TEV_2D_TTM_TRAP_TOT.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/E906nlo_bin_00.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/E906nlo_bin_00.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/FK_ATLASTTBARTOT13TEV.dat' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/FK_POSXDQ.dat' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHC8-Mtt-HT4-173_3-bin1.tab.gz' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCBWZMU7TEV_PI_part1.appl' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_DY_8TEV.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_DY_8TEV.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_WP_7TEV_old.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_WP_7TEV_opt.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_WP_7TEV.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_WP_7TEV_v2.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/LHCB_WP_7TEV_v2_xif_2.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/NJetEvents_0-0-2.tab.gz' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/NUTEV_CC_NU_FE_SIGMARED.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/NUTEV_CC_NU_FE_SIGMARED.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/dy_high_mass/CMS_DY_14TEV_MLL_6000_COSTH.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/dy_high_mass/NNPDF_DY_14TEV_BSM_AFB.pineappl.lz4' | |
curl -s -C - -O 'https://ploughshare.web.cern.ch/ploughshare/db/applfast/applfast-atlas-dijets-fnlo-arxiv-1312.3524/grids/applfast-atlas-dijets-fnlo-arxiv-1312.3524-xsec000.tab.gz' | |
curl -s -C - -O 'https://ploughshare.web.cern.ch/ploughshare/db/applfast/applfast-h1-dijets-appl-arxiv-0010054/grids/applfast-h1-dijets-appl-arxiv-0010054-xsec000.appl' | |
curl -s -C - -O 'https://ploughshare.web.cern.ch/ploughshare/db/applfast/applfast-h1-incjets-fnlo-arxiv-0706.3722/grids/applfast-h1-incjets-fnlo-arxiv-0706.3722-xsec000.tab.gz' | |
curl -s -C - -O 'https://ploughshare.web.cern.ch/ploughshare/db/atlas/atlas-atlas-wpm-arxiv-1109.5141/grids/atlas-atlas-wpm-arxiv-1109.5141-xsec001.appl' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/STAR_WMWP_510GEV_WM-AL-POL.pineappl.lz4' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/STAR_WMWP_510GEV_WM-AL-POL_PolPDF.tar' | |
curl -s -C - -O 'https://data.nnpdf.science/pineappl/test-data/STAR_WMWP_510GEV_WM-AL-POL_UnpolPDF.tar' | |
- name: Set RUSTDOCFLAGS | |
run: | | |
# relative paths sometimes don't work, so use an absolute path | |
echo "RUSTDOCFLAGS=-Cinstrument-coverage -Z unstable-options --persist-doctests $(pwd)/target/debug/doctestbins" >> "$GITHUB_ENV" | |
- name: Run tests | |
env: | |
# `-C link-dead-code` is needed to prevent 'warning: XX functions have mismatched data' warnings | |
RUSTFLAGS: '-Cinstrument-coverage -Clink-dead-code' | |
run: | | |
# we need stderr, but we can't run test twice because it'll regenerate/modify the binaries which interferes with `llvm-cov` | |
cargo test --features=applgrid,evolve,fastnlo,fktable --no-fail-fast 2> >(tee stderr 1>&2) | |
# from https://stackoverflow.com/a/51141872/812178 | |
sed -i 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' stderr | |
- name: Generate code coverage | |
run: | | |
find . -name '*.profraw' -exec $(rustc --print target-libdir)/../bin/llvm-profdata merge -sparse -o pineappl.profdata {} + | |
( sed -nE 's/[[:space:]]+Running( unittests|) [^[:space:]]+ \(([^)]+)\)/\2/p' stderr && echo target/debug/doctestbins/*/rust_out | tr ' ' "\n" ) | \ | |
xargs printf ' --object %s' | \ | |
xargs $(rustc --print target-libdir)/../bin/llvm-cov export \ | |
--ignore-filename-regex=index.crates.io \ | |
--ignore-filename-regex=rustc \ | |
--ignore-filename-regex=managed-lhapdf \ | |
--ignore-filename-regex=pineappl/tests \ | |
--ignore-filename-regex=pineappl_capi \ | |
--ignore-filename-regex=pineappl_cli/tests \ | |
--instr-profile=pineappl.profdata \ | |
--skip-functions \ | |
--object target/debug/pineappl \ | |
--format lcov > lcov.info | |
# print all files for which coverage has been generated | |
grep SF lcov.info | sort -u | sed 's/SF://' | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: rust |