Skip to content

Specify path to config file for bmi-tester #95

Specify path to config file for bmi-tester

Specify path to config file for bmi-tester #95

Workflow file for this run

name: 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}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: latest
environment-file: environment.yml
- name: Build and install HeatModelF
run: |
pushd ./external/bmi-example-fortran
cmake -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
cmake --build ${{ env.BUILD_DIR }} --target install --config Release
popd
- name: Build and install package
run: |
make install
- name: Test imports
working-directory: ${{ github.workspace }}/examples
run: |
python -c 'import pymt_heatf'
python -c 'from pymt.models import HeatModelF'
- name: Test BMI
run: |
make test
- name: Run examples
working-directory: ${{ github.workspace }}/examples
run: |
python heatf_ex.py
python pymt_heatf_ex.py
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
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ilammy/msvc-dev-cmd@v1
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: latest
environment-file: environment.yml
init-shell: >-
powershell
# - name: Set the PREFIX environment variable
# run: |
# echo "PREFIX=$env:MAMBA_ROOT_PREFIX\envs\fbld\Library" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Set the FC environment variable
run: |
echo "FC=$env:CONDA_PREFIX\Library\bin\flang-new.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# - name: Make a LINKER environment variable
# run: |
# echo "LINKER=$env:VCToolsInstallDir\bin\Host$env:RUNNER_ARCH\$env:Platform\link.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# - name: Make a LINK_DIR environment variable for MSVC link.exe
# run: |
# echo "LINK_DIR=$env:VCToolsInstallDir\bin\Host$env:RUNNER_ARCH\$env:Platform" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# - name: Push location of MSVC link.exe to the front of the path
# run: |
# echo "Path=$env:LINK_DIR;$env:Path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# - name: Force location of MSVC link.exe to the front of the path
# run: |
# echo "$env:VCToolsInstallDir\bin\Host$env:RUNNER_ARCH\$env:Platform" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Remove link.exe in the Git install
run: |
Remove-Item -Path "C:\Program Files\Git\usr\bin\link.exe" -Force
- name: Add conda environment libpath to Windows LIB (not LIBPATH)
run: |
echo "LIB=$env:LIB;$env:CONDA_PREFIX\Library\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: View environment variables
run: |
ls env:
ls env:LIB
- name: Configure, build, and install HeatModelF
run: |
pushd ./external/bmi-example-fortran
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
popd
- name: Build and install package
run: |
make install
- name: Test imports
working-directory: ${{ github.workspace }}/examples
run: |
python -c 'import pymt_heatf'
python -c 'from pymt.models import HeatModelF'
- name: Test BMI
working-directory: ${{ github.workspace }}
run: |
bmi-test pymt_heatf._bmi:HeatModelF --config-file=${{ github.workspace }}/examples/test.cfg --root-dir=examples -vvv
- name: Run examples
working-directory: ${{ github.workspace }}/examples
run: |
python heatf_ex.py
python pymt_heatf_ex.py