Skip to content

feat: Improve code coverage with post-process testing #2697

feat: Improve code coverage with post-process testing

feat: Improve code coverage with post-process testing #2697

Workflow file for this run

name: Coverage Check
on: [push, pull_request, workflow_dispatch]
jobs:
file-changes:
name: Detect File Changes
runs-on: 'ubuntu-latest'
outputs:
checkall: ${{ steps.changes.outputs.checkall }}
steps:
- name: Clone
uses: actions/checkout@v4
- name: Detect Changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: ".github/file-filter.yml"
run:
name: Coverage Test on CodeCov
if: needs.file-changes.outputs.checkall == 'true'
needs: file-changes
runs-on: "ubuntu-latest"
steps:
- name: Checkouts
uses: actions/checkout@v4
- name: Setup Ubuntu
run: |
sudo apt update -y
sudo apt install -y tar wget make cmake gcc g++ python3 \
python3-dev "openmpi-*" libopenmpi-dev hdf5-tools \
libfftw3-dev libhdf5-dev libblas-dev liblapack-dev
- name: Build
run: /bin/bash mfc.sh build -j $(nproc) --gcov
- name: Test
run: /bin/bash mfc.sh test -a -j $(nproc)
- name: Generate Coverage Reports
run: |
sudo apt install -y gcovr
gcovr build/staging --root . \
--gcov-executable gcov \
--filter 'src/.*' \
--html --html-details -o coverage_report.html \
--txt -o coverage_summary.txt \
--xml -o coverage.xml \
--print-summary
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage_report.html
coverage_summary.txt
coverage.xml
- name: Comment Coverage Summary
if: github.event_name == 'pull_request'
run: |
echo "## 📊 Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat coverage_summary.txt >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}