Skip to content

Test for pkg-config files; run ctest #29

Test for pkg-config files; run ctest

Test for pkg-config files; run ctest #29

Workflow file for this run

name: Build/Test
on: [push, pull_request]
jobs:
build-test-unix:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build-type: [Release]
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: latest
environment-name: testing
create-args: >-
cmake
pkg-config
fortran-compiler
bmi-fortran
- name: Make CMake build directory
run: cmake -E make_directory build
- name: Configure CMake
working-directory: ${{ github.workspace }}/build
run: |
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
- name: Build
working-directory: ${{ github.workspace }}/build
run: cmake --build . --target install --config ${{ matrix.build-type }}
- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ matrix.build-type }} --output-on-failure
- name: Memcheck
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ github.workspace }}/example
run: |
sudo apt-get update
sudo apt-get install -y valgrind
valgrind \
--tool=memcheck \
--leak-check=yes \
--show-reachable=yes \
--num-callers=20 \
--track-fds=yes \
run_bmiheatf test1.cfg
build-test-windows:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: windows-latest
env:
LIBRARY_PREFIX: $env:CONDA_PREFIX\Library
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: latest
environment-name: testing
create-args: >-
cmake
pkg-config
cxx-compiler
init-shell: >-
powershell
# The Fortran conda compiler doesn't seem to work on Windows in Actions.
# Instead, use the gfortran installed by chocolately. However, we then
# can't use the bmi-fortran package from conda-forge because it's not
# ABI-compatible. So, build bmi-fortran locally, This is a hack
# workaround.
- name: Build the bmi-fortran specification locally
run: |
curl -o bmi-fortran.zip -L https://github.com/csdms/bmi-fortran/archive/refs/heads/master.zip
unzip bmi-fortran.zip
cd bmi-fortran-master
mkdir build && cd build
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release
cd ${{ github.workspace }}
- name: Make cmake build directory
run: cmake -E make_directory build
- name: Configure, build, and install
working-directory: ${{ github.workspace }}/build
run: |
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release
- name: Test installed files
run: |
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libheatf.a ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_heatf.exe ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\heatf.mod ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\pkgconfig\heatf.pc ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_bmiheatf.exe ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmiheatf.a ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\bmiheatf.mod ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\pkgconfig\bmiheatf.pc ) ){ exit 1 }
- name: Unit test with CTest
working-directory: ${{ github.workspace }}/build
run: ctest -C Release -VV --output-on-failure