Improve CAPI examples #556
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: CAPI | |
on: | |
push: | |
jobs: | |
capi: | |
runs-on: ubuntu-latest | |
container: ghcr.io/nnpdf/pineappl-ci:latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install PineAPPL's C API | |
run: | | |
export RUSTFLAGS="-Cinstrument-coverage" | |
cargo cinstall --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml | |
ldconfig | |
- name: Test C++ example | |
run: | | |
cd examples/cpp | |
# if `make` is too old, it doesn't support the `!=` operator | |
sed -i "s/\([a-zA-Z_]\+\) != \(.*\)$/echo \1 = \$(\2)/e" Makefile | |
make test-examples | |
- name: Test Fortran example | |
run: | | |
cd examples/fortran | |
sed -i "s/\([a-zA-Z_]\+\) != \(.*\)$/echo \1 = \$(\2)/e" Makefile | |
make | |
./dyaa | |
test -f ./DY-LO-AA.pineappl.lz4 | |
- name: Test OO C++ example | |
run: | | |
cd examples/object-oriented-cpp | |
sed -i "s/\([a-zA-Z_]\+\) != \(.*\)$/echo \1 = \$(\2)/e" Makefile | |
make | |
./dyaa | |
test -f ./DY-LO-AA.pineappl.lz4 | |
- name: Generate code coverage | |
run: | | |
find . -name '*.profraw' -exec $(rustc --print target-libdir)/../bin/llvm-profdata merge -sparse -o pineappl.profdata {} + | |
$(rustc --print target-libdir)/../bin/llvm-cov export \ | |
--ignore-filename-regex='/.cargo/registry' \ | |
--ignore-filename-regex='/cargo/registry' \ | |
--ignore-filename-regex='rustc' \ | |
--instr-profile=pineappl.profdata \ | |
--skip-functions \ | |
--object /usr/local/lib/libpineappl_capi.so.*.*.* \ | |
--format lcov > lcov.info | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
flags: capi |