From 42f8e1a4fedd2475b76b70c0e9661d0a21b8c44a Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 1 Sep 2023 15:22:26 +0200 Subject: [PATCH 1/9] Generate CAPI coverage --- .github/workflows/capi.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/capi.yaml b/.github/workflows/capi.yaml index efc197da..22ea0baa 100644 --- a/.github/workflows/capi.yaml +++ b/.github/workflows/capi.yaml @@ -12,7 +12,7 @@ jobs: - name: Install PineAPPL's C API run: | - cargo cinstall --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml + RUSTFLAGS="-Cinstrument-coverage" cargo cinstall --debug --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml ldconfig - name: Test C example @@ -39,3 +39,21 @@ jobs: 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 From d8bc44f2dbfd9686214a2df148253202b3cceb82 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 4 Sep 2023 15:47:38 +0200 Subject: [PATCH 2/9] Try exporting `RUSTFLAGS` variable differently --- .github/workflows/capi.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/capi.yaml b/.github/workflows/capi.yaml index 22ea0baa..d61fc997 100644 --- a/.github/workflows/capi.yaml +++ b/.github/workflows/capi.yaml @@ -12,7 +12,8 @@ jobs: - name: Install PineAPPL's C API run: | - RUSTFLAGS="-Cinstrument-coverage" cargo cinstall --debug --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml + export RUSTFLAGS="-Cinstrument-coverage" + cargo cinstall --debug --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml ldconfig - name: Test C example From d42d062741a90d24b53b2d4dc850277ecb2a8608 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 4 Sep 2023 15:56:03 +0200 Subject: [PATCH 3/9] Remove `--debug` flag --- .github/workflows/capi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/capi.yaml b/.github/workflows/capi.yaml index d61fc997..5b7ee7d0 100644 --- a/.github/workflows/capi.yaml +++ b/.github/workflows/capi.yaml @@ -13,7 +13,7 @@ jobs: - name: Install PineAPPL's C API run: | export RUSTFLAGS="-Cinstrument-coverage" - cargo cinstall --debug --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml + cargo cinstall --verbose --prefix=/usr/local/ --manifest-path pineappl_capi/Cargo.toml ldconfig - name: Test C example From 0a7e14025e8f4a49a2982d99e0338129151dc888 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 4 Sep 2023 16:45:11 +0200 Subject: [PATCH 4/9] Update `cargo-c` in container --- maintainer/pineappl-ci/Containerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maintainer/pineappl-ci/Containerfile b/maintainer/pineappl-ci/Containerfile index 51e56017..357618f7 100644 --- a/maintainer/pineappl-ci/Containerfile +++ b/maintainer/pineappl-ci/Containerfile @@ -1,7 +1,8 @@ FROM quay.io/pypa/manylinux2014_x86_64 ARG APPLGRID_V=1.6.27 -ARG CARGOC_V=0.9.14+cargo-0.67 +# must be at least 0.9.16, see https://github.com/NNPDF/pineappl/pull/242#issuecomment-1705371291 +ARG CARGOC_V=0.9.24+cargo-0.73.0 ARG FASTNLO_V=2.5.0-2826 ARG LHAPDF_V=6.4.0 From 4b998cf842419612a7b9929b02f2277eeb9e37f3 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 6 Sep 2023 14:14:12 +0200 Subject: [PATCH 5/9] Use Wayback Machine as a mirror for hepforge --- maintainer/pineappl-ci/script.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maintainer/pineappl-ci/script.sh b/maintainer/pineappl-ci/script.sh index 61fa4727..c27f2019 100755 --- a/maintainer/pineappl-ci/script.sh +++ b/maintainer/pineappl-ci/script.sh @@ -22,8 +22,9 @@ cargo install cargo-c --version ${CARGOC_V} --features=vendored-openssl # remove files generated by cargo rm -r /usr/local/cargo/registry -# install LHAPDF -curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${LHAPDF_V}.tar.gz" | tar xzf - +# install LHAPDF - use Wayback Machine as a mirror if hepforge is offline +( curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${LHAPDF_V}.tar.gz" || \ + curl "https://web.archive.org/web/20211018095814/https://lhapdf.hepforge.org/downloads/?f=LHAPDF-6.4.0.tar.gz" ) | tar xzf - cd LHAPDF-${LHAPDF_V} ./configure --disable-python --disable-static make -j From c40d1069fddf1dadfe59e142794811ce71d924b5 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 6 Sep 2023 14:24:10 +0200 Subject: [PATCH 6/9] Try bulding `cargo-c` without vendored openssl --- maintainer/pineappl-ci/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainer/pineappl-ci/script.sh b/maintainer/pineappl-ci/script.sh index c27f2019..7df3ecb8 100755 --- a/maintainer/pineappl-ci/script.sh +++ b/maintainer/pineappl-ci/script.sh @@ -17,7 +17,7 @@ done # apt install gfortran -y # install cargo-c needed for the CAPI -cargo install cargo-c --version ${CARGOC_V} --features=vendored-openssl +cargo install cargo-c --version ${CARGOC_V} # remove files generated by cargo rm -r /usr/local/cargo/registry From 8d25063cdb46a03359cb4ef6ef7a83b36db15d02 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 6 Sep 2023 14:35:26 +0200 Subject: [PATCH 7/9] Revert "Try bulding `cargo-c` without vendored openssl" This reverts commit c40d1069fddf1dadfe59e142794811ce71d924b5. --- maintainer/pineappl-ci/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainer/pineappl-ci/script.sh b/maintainer/pineappl-ci/script.sh index 7df3ecb8..c27f2019 100755 --- a/maintainer/pineappl-ci/script.sh +++ b/maintainer/pineappl-ci/script.sh @@ -17,7 +17,7 @@ done # apt install gfortran -y # install cargo-c needed for the CAPI -cargo install cargo-c --version ${CARGOC_V} +cargo install cargo-c --version ${CARGOC_V} --features=vendored-openssl # remove files generated by cargo rm -r /usr/local/cargo/registry From 8c7e0db79cbc2e7c8624568898b2c1e61ee0b2c7 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 6 Sep 2023 14:36:34 +0200 Subject: [PATCH 8/9] Install `perl-IPC-Cmd` --- maintainer/pineappl-ci/script.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maintainer/pineappl-ci/script.sh b/maintainer/pineappl-ci/script.sh index c27f2019..bf81680c 100755 --- a/maintainer/pineappl-ci/script.sh +++ b/maintainer/pineappl-ci/script.sh @@ -16,6 +16,9 @@ done # apt update # apt install gfortran -y +# needed by the vendored OpenSSL used by `cargo-c` +yum install perl-IPC-Cmd + # install cargo-c needed for the CAPI cargo install cargo-c --version ${CARGOC_V} --features=vendored-openssl From 0718cc39b220af0f19f47d2a3538059dce0f4a13 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 6 Sep 2023 14:42:28 +0200 Subject: [PATCH 9/9] Add `-y` to `yum` to installation of `perl-IPC-Cmd` --- maintainer/pineappl-ci/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainer/pineappl-ci/script.sh b/maintainer/pineappl-ci/script.sh index bf81680c..17552a7d 100755 --- a/maintainer/pineappl-ci/script.sh +++ b/maintainer/pineappl-ci/script.sh @@ -17,7 +17,7 @@ done # apt install gfortran -y # needed by the vendored OpenSSL used by `cargo-c` -yum install perl-IPC-Cmd +yum -y install perl-IPC-Cmd # install cargo-c needed for the CAPI cargo install cargo-c --version ${CARGOC_V} --features=vendored-openssl