Skip to content

Test domain layer implementation #1631

Test domain layer implementation

Test domain layer implementation #1631

name: Module Integration Tests
# Controls when the action will run.
on:
push:
branches: [ master, dev, notreal ]
pull_request:
branches: [ master, dev, notreal ]
workflow_dispatch:
env:
# Obtained from https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# TODO: add something later that can check the runners for hyperthreading
LINUX_NUM_PROC_CORES: 2
MACOS_NUM_PROC_CORES: 3
ASAN_OPTIONS: detect_leaks=false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Run general unit tests in linux environment
test_surfacebmi_plus_cfe:
# The type of runner that the job will run on
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
fail-fast: false
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Build NGen
uses: ./.github/actions/ngen-build
with:
targets: "ngen"
build-cores: ${{ env.LINUX_NUM_PROC_CORES }}
bmi_c: 'ON'
bmi_fortran: 'ON'
timeout-minutes: 15
- name: Run surfacebmi plus cfebmi
run: |
inputfile='data/example_bmi_multi_realization_config.json'
./cmake_build/ngen || true
./cmake_build/ngen data/catchment_data.geojson "cat-27" data/nexus_data.geojson "nex-26" $inputfile
- name: Run surfacebmi, cfebmi and petbmi
run: |
inputfile='data/example_bmi_multi_realization_config_w_noah_pet_cfe.json'
./cmake_build/ngen || true
./cmake_build/ngen data/catchment_data.geojson "cat-27" data/nexus_data.geojson "nex-26" $inputfile
# Run t-route/pybind integration test
test_troute_integration:
# The type of runner that the job will run on
strategy:
matrix:
os: [ubuntu-22.04] # [ubuntu-latest, macos-12] #TODO: Fix #505
fail-fast: false
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Build Ngen
uses: ./.github/actions/ngen-build
with:
targets: "test_routing_pybind"
build-cores: ${{ env.LINUX_NUM_PROC_CORES }}
#is this required for this test?
use_python: 'ON'
use_troute: 'ON'
timeout-minutes: 15
# Disabling this cache for the time being for a few reasons
# 1) t-route build/install can be tricky without pre-cythonized sources
# 2) may not want to use a cached version of t-route if we are testing its integration
# we want to use the latest code in the repo and make sure it works...a cached version
# wouldn't be good for that...
#- name: Cache troute dependency
# id: cache-linux-troute-dep
# uses: actions/cache@v1
# with:
# path: .venv
# key: linux-troute-dep-fixed
- name: Checkout t-route (latest master)
uses: actions/checkout@v3
with:
repository: NOAA-OWP/t-route
path: t-route
#This step should come after ngen build???
- name: Configure Fortran Compiler
run: |
if [ ${{ runner.os }} == 'macOS' ]
then
sudo ln -s $(which gfortran-11) $(dirname $(which gfortran-11))/gfortran
export FC=gfortran-11
export F90=gfortran-11
fi
- name: Build T-route Dependency
#if: steps.cache-linux-troute-dep.outputs.cache-hit != 'true'
#MacOS pybind has issues with egg links, so install all packages without egg links on that os
run: |
python3 -m venv .venv
. .venv/bin/activate
cd t-route
pip install 'pip>=23.0,<23.1'
pip install -U setuptools
pip install -r requirements.txt
pip install deprecated 'pyarrow==11.0.0' tables geopandas numpy
if [ ${{ runner.os }} == 'macOS' ]
then
export LIBRARY_PATH=/usr/local/lib/gcc/11/
export LD_LIBRARY_PATH=/usr/local/lib/gcc/11/
fi
export NETCDFALTERNATIVE=${NETCDF}/include
export FC=gfortran
export F90=gfortran
./compiler.sh no-e
deactivate
- name: Run test
run: |
. .venv/bin/activate
./cmake_build/test/test_routing_pybind
deactivate