C++ and Python coverage #103
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: C++ and Python coverage | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash -l {0} # required for conda env | |
jobs: | |
coverage: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install dependencies | |
run: | | |
# We use g++ from system instead of from conda, since we need to ensure that | |
# a matching gcov is used. Otherwise coverage results are incomplete/broken. | |
sudo apt install --yes lcov g++-11 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 | |
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-11 100 | |
sudo update-alternatives --set g++ "/usr/bin/g++-11" | |
sudo update-alternatives --set gcov "/usr/bin/gcov-11" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 # history required so cmake can determine version | |
- name: Disable TBB for much faster compilation. | |
run: cat .buildconfig/ci-linux.yml | grep -v 'gxx\|tbb' > env.yml | |
- name: Setup conda environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: 1.5.6-0 | |
environment-file: env.yml | |
cache-environment: true | |
create-args: python=3.10 | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1.2.13 | |
with: | |
key: coverage | |
- name: C++ coverage | |
run: | | |
mkdir coverage_html | |
cmake --preset coverage | |
cmake --build --preset coverage | |
mv build/coverage coverage_html/cpp | |
- name: Python coverage | |
run: | | |
tox -e coverage | |
rm -f coverage_html/python/.gitignore | |
- name: Setup HTML | |
run: mv tools/scipp-coverage-index.html coverage_html/index.html | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4.6.0 | |
with: | |
repository-name: scipp/scipp-coverage | |
branch: main | |
folder: coverage_html | |
single-commit: true | |
ssh-key: ${{ secrets.COVERAGE_DEPLOY_KEY }} |