Skip to content

Commit

Permalink
Merge pull request #12 from permamodel/mdpiper/use-github-actions
Browse files Browse the repository at this point in the history
Set up CI with GitHub Actions
  • Loading branch information
mdpiper authored Jan 23, 2025
2 parents c17014b + d56569e commit 4728b8f
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Test

on: [push, pull_request]

env:
BMI_VERSION: 1_2
BUILD_DIR: _build

jobs:
build-on-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]

steps:
- uses: actions/checkout@v4

- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: latest
environment-name: testing
create-args: >-
make
cmake
pkg-config
fortran-compiler
- name: Configure project
run: cmake -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release

- name: Build and install
run: cmake --build ${{ env.BUILD_DIR }} --target install --config Release

- name: Test
run: |
test -h $CONDA_PREFIX/lib/libbmisnowf${{ env.SHLIB_EXT }}
ctest -V --test-dir ${{ env.BUILD_DIR }}
build-on-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
init-shell: >-
powershell
- name: Set the FC environment variable to the Fortran conda compiler
run: |
echo "FC=$CONDA_PREFIX/Library/bin/flang-new.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Configure, build, and install project
run: |
cmake -B ${{ env.BUILD_DIR }} -G Ninja -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build ${{ env.BUILD_DIR }} --target install --config Release
- name: Test
run: |
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\run_bmisnow_model.exe ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\bmisnowf.lib ) ){ exit 1 }
if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\include\bmisnowf.mod ) ){ exit 1 }
# ctest -V --test-dir ${{ env.BUILD_DIR }}

0 comments on commit 4728b8f

Please sign in to comment.