Skip to content

Use library names from flang, not gfortran #42

Use library names from flang, not gfortran

Use library names from flang, not gfortran #42

Workflow file for this run

name: Build/Test
on: [push, pull_request]
env:
BUILD_DIR: _build
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}
env:
SHLIB_EXT: ${{ matrix.os == 'ubuntu-latest' && '.so' || '.dylib' }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build-type: [Release]
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: latest
environment-name: testing
create-args: >-
cmake
pkg-config
fortran-compiler
bmi-fortran
- name: Configure project
run: |
cmake $GITHUB_WORKSPACE -B ${{ env.BUILD_DIR }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
- name: Build and install project
run: cmake --build ${{ env.BUILD_DIR }} --target install --config ${{ matrix.build-type }}
- name: Test for installed files
run: |
test -h $CONDA_PREFIX/lib/libheatf${{ env.SHLIB_EXT }}
test -f $CONDA_PREFIX/include/heatf.mod
test -f $CONDA_PREFIX/lib/pkgconfig/heatf.pc
test -h $CONDA_PREFIX/lib/libbmiheatf${{ env.SHLIB_EXT }}
test -f $CONDA_PREFIX/include/bmiheatf.mod
test -f $CONDA_PREFIX/lib/pkgconfig/bmiheatf.pc
- name: Run project tests
run: ctest --test-dir ${{ env.BUILD_DIR }} -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@v2
with:
micromamba-version: latest
environment-name: testing
create-args: >-
cmake
pkg-config
cxx-compiler
fortran-compiler
bmi-fortran
init-shell: >-
powershell
- name: Set the FC environment variable to the Fortran conda compiler
run: |
echo "FC=$env:CONDA_PREFIX\Library\bin\flang-new.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: List current environment variables
run: |
ls env:
- name: Configure, build, and install project
run: |
cmake -B ${{ env.BUILD_DIR }} -LA -G Ninja -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build ${{ env.BUILD_DIR }} --target install --config Release
- name: Test for installed files
run: |
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\heatf.lib ) ){ 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\bmiheatf.lib ) ){ 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: Run CTest
working-directory: ${{ github.workspace }}/build
run: ctest --test-dir ${{ env.BUILD_DIR }} -C Release -VV --output-on-failure