v1.1.1 Improve AGOX compatibility #149
This file contains hidden or 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: run-code-coverage | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- ".github/workflows/coverage.yml" | |
- "CMakeLists.txt" | |
- "**.f90" | |
- "**.F90" | |
- "**.cmake" | |
pull_request: | |
branches: | |
- "main" | |
types: | |
- opened | |
- synchronize | |
paths: | |
- ".github/workflows/coverage.yml" | |
- "CMakeLists.txt" | |
- "**.f90" | |
- "**.F90" | |
- "**.cmake" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
jobs: | |
run-code-coverage: | |
# permissions: | |
# contents: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [gcc] | |
version: [13] | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: actions-setup-cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.24.x' | |
- uses: fortran-lang/setup-fortran@v1 | |
id: setup-fortran | |
with: | |
compiler: ${{ matrix.compiler }} | |
version: ${{ matrix.version }} | |
- name: Install gcovr | |
run: | | |
pip --version | |
pip install gcovr | |
- name: Build project | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake make | |
cmake --version | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Coverage -DBUILD_PYTHON=Off -DBUILD_EXECUTABLE=Off .. | |
make | |
- name: Run coverage tests | |
run: | | |
cd build | |
env CTEST_OUTPUT_ON_FAILURE=1 make coverage | |
- name: Get coverage percentage | |
run: | | |
pip install bs4 | |
echo "COVERAGE_PERCENTAGE="$(python ./tools/coverage_badge.py) >> $GITHUB_ENV | |
- name: Create coverage badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 48f14ebb5636b54d3813e4b4494903eb | |
filename: raffle_coverage_${{ github.head_ref || github.ref_name }}.json # Use branch-specific file | |
label: Coverage | |
message: ${{ env.COVERAGE_PERCENTAGE }}% | |
valColorRange: ${{ env.COVERAGE_PERCENTAGE }} | |
maxColorRange: 100 | |
minColorRange: 0 | |
- name: upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: './build/coverage/' | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: run-code-coverage | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: deploy to Github Pages (main branch) | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
# - name: deploy to Github Pages (development branch) | |
# if: ${{ github.ref != 'refs/heads/main' }} | |
# uses: peaceiris/actions-gh-pages@v4 | |
# with: | |
# publish_dir: ./build/coverage/ | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# destination_dir: development-branch/ |