cmake: examples: simplify #248
Workflow file for this run
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: ci | |
env: | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
CMAKE_BUILD_PARALLEL_LEVEL: 4 | |
CTEST_PARALLEL_LEVEL: 0 | |
CTEST_NO_TESTS_ACTION: error | |
CMAKE_INSTALL_PREFIX: ~/libs | |
CMAKE_PREFIX_PATH: ~/libs | |
on: | |
push: | |
paths: | |
- "**/CMakeLists.txt" | |
- "**.cmake" | |
- "**.f90" | |
- ".github/workflows/ci.yml" | |
- "!cmake/netcdf.cmake" | |
- "!cmake/netcdf-c.cmake" | |
- "!cmake/hdf5.cmake" | |
- "!scripts/**" | |
jobs: | |
base: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
env: | |
FC: gfortran-14 | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, macos-latest] | |
shared: [true, false] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install NetCDF system libs | |
if: runner.os == 'Linux' | |
run: sudo apt install --no-install-recommends ninja-build libnetcdff-dev | |
- name: install NetCDF system libs | |
if: runner.os == 'macOS' | |
run: brew install ninja netcdf-fortran | |
- run: >- | |
cmake | |
--preset multi | |
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} | |
- run: cmake --build --preset debug | |
- run: ctest --preset debug | |
- run: cmake --build --preset release | |
- run: ctest --preset release | |
- run: cmake --install build | |
- name: configure examples | |
run: >- | |
cmake | |
-S example | |
-B example/build | |
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} | |
- name: build examples | |
run: cmake --build example/build | |
- name: Test examples | |
run: ctest --test-dir example/build -V | |
build: | |
needs: base | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
env: | |
FC: gfortran-14 | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install HDF5 (macOS) | |
if: runner.os == 'macOS' | |
run: brew install hdf5 | |
- name: install HDF5 (Linux) | |
if: runner.os == 'Linux' | |
run: sudo apt install --no-install-recommends libhdf5-dev | |
- name: GCC Linux | |
if: runner.os == 'Linux' | |
run: | | |
echo "CC=gcc-14" >> $GITHUB_ENV | |
- run: cmake --workflow --preset default | |
- run: cmake --install build | |
- name: configure examples | |
run: cmake -S example -B example/build | |
- name: build examples | |
run: cmake --build example/build | |
- name: Test examples | |
run: ctest --test-dir example/build -V | |
linux-coverage: | |
if: github.event_name == 'release' | |
needs: base | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: install prereqs | |
run: | | |
sudo apt update | |
sudo apt install --no-install-recommends libnetcdff-dev | |
- name: install Gcovr | |
run: pip install gcovr | |
- run: cmake --preset coverage | |
- run: cmake --build --preset coverage | |
- name: Code coverage | |
run: cmake --build --preset run-coverage | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-html | |
path: build-coverage/coverage/ |