Merge pull request #288 from dglaeser/feature/improve-release-procedu… #124
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
# SPDX-FileCopyrightText: 2022 Dennis Gläser <[email protected]> | |
# SPDX-License-Identifier: MIT | |
name: pages | |
on: | |
push: | |
branches: [ main ] | |
env: | |
OMPI_ALLOW_RUN_AS_ROOT: 1 | |
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 | |
permissions: | |
contents: write | |
pages: write | |
jobs: | |
coverage-and-deploy: | |
runs-on: ubuntu-22.04 | |
container: dglaeser/gridformat-action-images:full | |
steps: | |
- name: checkout-repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: prepare-python-env | |
uses: ./.github/actions/prepare-python-env | |
- name: configure | |
run: | | |
rm -rf build | |
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc-14 \ | |
-DCMAKE_CXX_COMPILER=/usr/bin/g++-14 \ | |
-DCMAKE_PREFIX_PATH=/gfmt-dependencies \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DGRIDFORMAT_BUILD_TESTS=ON \ | |
-DGRIDFORMAT_DO_COVERAGE=ON \ | |
-DGRIDFORMAT_BUILD_DOCS=ON \ | |
-DGCOV_PATH=/usr/bin/gcov-14 \ | |
-B build | |
- name: build-doxygen-documentation | |
run: | | |
git config --global --add safe.directory $PWD | |
cd build && make doc_doxygen | |
mkdir -p public && cp -r docs/doxygen/html/* public | |
- name: run-coverage | |
run: | | |
cd build && make test_coverage | |
mkdir -p public && cp -r test_coverage public | |
- name: make-coverage-badge | |
run: | | |
echo "import subprocess" > _script.py | |
echo "percentage = float(open('build/test_coverage.xml').read().split('line-rate=\"')[1].split('\"')[0])*100.0" >> _script.py | |
echo "color = 'success' if percentage >= 90. else ('yellow' if percentage >= 75. else 'red')" >> _script.py | |
echo "subprocess.run(['wget', f'https://img.shields.io/badge/coverage-{percentage:.2f}%25-{color}', '-O', 'coverage.svg'], check=True)" >> _script.py | |
echo "print(f'Overall coverage is: {percentage:.2f}')" | |
python3 _script.py | |
cp coverage.svg build/public | |
- name: deploy-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build/public |