Skip to content

Initial pFUnit Integration #11

Initial pFUnit Integration

Initial pFUnit Integration #11

name: Fortran Unit Tests
on:
push:
branches:
- development
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
gcc-toolchain:
runs-on: ubuntu-latest
steps:
- name: Checkout cam-sima
uses: actions/checkout@v4
- name: Build pFUnit
run: |
git clone --depth 1 --branch v4.10.0 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
cd pFUnit
cmake -B./build -S.
cd build
make install
- name: Build cam-sima
run: |
cmake \
-DCMAKE_PREFIX_PATH=/home/runner/work/CAM-SIMA/CAM-SIMA/pFUnit/build/installed \
-DCAM_SIMA_ENABLE_CODE_COVERAGE=ON \
-B./build \
-S./test/unit/fortran
cd build
make
- name: Run fortran unit tests
run: |
cd build && ctest -V --output-on-failure --output-junit test_results.xml
- name: Upload unit test results
uses: actions/upload-artifact@v4
with:
name: unit-test-results
path: build/test_results.xml
- name: Setup GCov
run: |
python3 -m venv venv
source venv/bin/activate
pip3 install gcovr
- name: Run Gcov
run: |
source venv/bin/activate
cd build
gcovr -r .. --filter '\.\./src' --html cam_sima_code_coverage.html --txt
- name: Upload code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-results
path: build/cam_sima_code_coverage.html