generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LGAR-C workflow for automated tests (#15)
* Test Lgar=C in standalone mode * Add ngen integration * Change trigger name * Add conditional for removing LGAR-C dir * Fix a bug in ngen_integration.yaml * Fix realization path * Move some data file into appropriate dir * Add sft test * Revise workflow file * Fix a path error in realization files * Fix a bug in workflow file * Fix a sft file path name error * Add SMP test * Removing potentially unnecessary libs builds * Removing buid PET submodule * Re-order the various tests in standalone runs
- Loading branch information
Showing
5 changed files
with
502 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Test changes that have been pushed to the master branch | ||
|
||
name: Testing and Validation | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
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 | ||
|
||
# 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_unit: | ||
# The type of runner that the job will run on | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Checkout the commit | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and Run Unittest | ||
run: | | ||
mkdir build && cd build | ||
cmake ../ -DUNITTEST=ON | ||
make && cd ../tests | ||
./run_unittest.sh && cd .. | ||
- name: Build and Run Synthetic Tests | ||
run: | | ||
if [ -d "./build/" ] | ||
then | ||
rm -rf build | ||
fi | ||
mkdir build && cd build | ||
cmake ../ -DSTANDALONE=ON | ||
make && cd ../tests | ||
./run_synthetic.sh 0 | ||
./run_synthetic.sh 1 | ||
./run_synthetic.sh 2 | ||
- name: Build and Run Standalone | ||
run: | | ||
if [ -d "./build/" ] | ||
then | ||
rm -rf build | ||
fi | ||
mkdir build && cd build | ||
cmake ../ -DSTANDALONE=ON | ||
make && cd .. | ||
./build/lasam_standalone configs/config_lasam_Phillipsburg.txt | ||
./build/lasam_standalone configs/config_lasam_Bushland.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# Test ngen-lgar-c integration | ||
|
||
name: Ngen 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_lgar-c: | ||
# The type of runner that the job will run on | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checkout and build the LGAR-C | ||
- name: Checkout the commit | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build the LGAR-C Library | ||
run: | | ||
cmake -B cmake_build -S . -DNGEN=ON | ||
make -C cmake_build | ||
- name: Save LGAR-C to a Temp Directory | ||
run: | | ||
# Move files to a temporary directory | ||
mkdir ${{runner.temp}}/lgar | ||
mv ./* ${{runner.temp}}/lgar | ||
# Checkout and build the SoilMoistureProfiles | ||
- name: Checkout the commit | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: noaa-owp/soilmoistureprofiles | ||
|
||
- name: Build the SMP Library | ||
run: | | ||
cmake -B cmake_build -S . -DNGEN=ON | ||
make -C cmake_build | ||
- name: Save SoilMoistureProfile to a Temp Directory | ||
run: | | ||
# Move files to a temporary directory | ||
mkdir ${{runner.temp}}/smp | ||
mv ./* ${{runner.temp}}/smp | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: checkout actions in another repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: noaa-owp/soilfreezethaw | ||
|
||
- name: Build the SFT Library | ||
run: | | ||
cmake -B cmake_build -S . -DNGEN=ON | ||
make -C cmake_build | ||
- name: Save SoilFreezeThaw to a Temp Directory | ||
run: | | ||
# Move files to a temporary directory | ||
mkdir ${{runner.temp}}/sft | ||
mv ./* ${{runner.temp}}/sft | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: checkout actions in another repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: noaa-owp/ngen | ||
|
||
- name: Build SLoTH | ||
id: submod_build_6 | ||
uses: ./.github/actions/ngen-submod-build | ||
with: | ||
mod-dir: "extern/sloth/" | ||
targets: "slothmodel" | ||
|
||
# Build Ngen and save some files | ||
- name: Build Ngen | ||
id: ngen_id1 | ||
uses: ./.github/actions/ngen-build | ||
with: | ||
targets: "ngen" | ||
build-cores: ${{ env.LINUX_NUM_PROC_CORES }} | ||
#is this required for this test? | ||
bmi_c: 'ON' | ||
timeout-minutes: 15 | ||
|
||
- name: Move LGAR-C File Including cmake_build to Appropriate Directory | ||
run: | | ||
if [ -d "./extern/LGAR-C/" ] | ||
then | ||
rm -rf extern/LGAR-C | ||
fi | ||
mkdir extern/LGAR-C | ||
mv ${{runner.temp}}/lgar/* extern/LGAR-C | ||
- name: Move SFT Files Including cmake_build to Appropriate Directory | ||
run: | | ||
rm -rf extern/SoilFreezeThaw/SoilFreezeThaw/* | ||
mv ${{runner.temp}}/sft/* extern/SoilFreezeThaw/SoilFreezeThaw | ||
- name: Move SMP Files Including cmake_build to Appropriate Directory | ||
run: | | ||
rm -rf extern/SoilMoistureProfiles/SoilMoistureProfiles/* | ||
mv ${{runner.temp}}/smp/* extern/SoilMoistureProfiles/SoilMoistureProfiles | ||
- name: Run Ngen Test with LASAM | ||
run: | | ||
# Run ngen with sft, smp, and lasam | ||
mv ${{ steps.ngen_id1.outputs.build-dir }} ./ngen-build/ | ||
cp extern/LGAR-C/data/vG_default_params.dat data/ | ||
inputfile='extern/LGAR-C/realizations/realization_config_lasam_ngenCI.json' | ||
./ngen-build/ngen ./data/catchment_data.geojson "cat-27" ./data/nexus_data.geojson "nex-26" $inputfile | ||
- name: Run Ngen Test with SFT and SMP | ||
run: | | ||
inputfile='extern/LGAR-C/realizations/realization_config_lasam_sft_ngenCI.json' | ||
./ngen-build/ngen ./data/catchment_data.geojson "cat-27" ./data/nexus_data.geojson "nex-26" $inputfile | ||
- name: Run Ngen Test with SMP | ||
run: | | ||
inputfile='extern/LGAR-C/realizations/realization_config_lasam_smp_ngenCI.json' | ||
./ngen-build/ngen ./data/catchment_data.geojson "cat-27" ./data/nexus_data.geojson "nex-26" $inputfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"time": { | ||
"start_time": "2016-10-01 00:00:00", | ||
"end_time": "2017-08-09 11:00:00", | ||
"output_interval": 3600 | ||
}, | ||
"catchments": { | ||
"cat-27": { | ||
"formulations": [ | ||
{ | ||
"name": "bmi_multi", | ||
"params": { | ||
"model_type_name": "bmi_multi_lasam", | ||
"forcing_file": "", | ||
"init_config": "", | ||
"allow_exceed_end_time": true, | ||
"main_output_variable": "total_discharge", | ||
"output_variables" : [ | ||
"precipitation", | ||
"potential_evapotranspiration", | ||
"actual_evapotranspiration", | ||
"surface_runoff", | ||
"giuh_runoff", | ||
"soil_storage", | ||
"total_discharge", | ||
"infiltration", | ||
"percolation" | ||
], | ||
"modules": [ | ||
{ | ||
"name": "bmi_c++", | ||
"params": { | ||
"model_type_name": "bmi_c++_sloth", | ||
"library_file": "./extern/sloth/cmake_build/libslothmodel", | ||
"init_config": "/dev/null", | ||
"allow_exceed_end_time": true, | ||
"main_output_variable": "z", | ||
"uses_forcing_file": false, | ||
"model_params": { | ||
"soil_temperature_profile(1,double,K,node)" : 275.15 | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "bmi_c++", | ||
"params": { | ||
"model_type_name": "bmi_lasam", | ||
"library_file": "./extern/LGAR-C/cmake_build/liblasambmi", | ||
"init_config": "./extern/LGAR-C/configs/config_lasam_Phillipsburg.txt", | ||
"allow_exceed_end_time": true, | ||
"main_output_variable": "precipitation_rate", | ||
"variables_names_map" : { | ||
"precipitation_rate" : "P", | ||
"potential_evapotranspiration_rate" : "PET" | ||
}, | ||
"output_variables" : [ | ||
"precipitation", | ||
"potential_evapotranspiration", | ||
"actual_evapotranspiration", | ||
"surface_runoff", | ||
"giuh_runoff", | ||
"soil_storage", | ||
"total_discharge", | ||
"infiltration", | ||
"percolation" | ||
], | ||
"uses_forcing_file": false | ||
} | ||
} | ||
], | ||
"uses_forcing_file": false | ||
} | ||
} | ||
], | ||
"forcing": { | ||
"path" : "./extern/LGAR-C/forcing/forcing_data_resampled_uniform_Phillipsburg.csv" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.