forked from NOAA-OWP/noah-owp-modular
-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (69 loc) · 2.48 KB
/
Build_and_Run_Standalone_Test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Test changes that have been pushed to the main branch
name: Testing and Validation
# Controls when the action will run.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
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: Install NetCDF
run: |
if [ ${{ runner.os }} == 'Linux' ]
then
sudo apt-get update
sudo apt-get install -y --fix-missing libnetcdf-dev libnetcdff-dev libnetcdf-c++4-1 libnetcdf-c++4-dev
echo "NETCDF=/usr" >> $GITHUB_ENV
elif [ ${{ runner.os }} == 'macOS' ]
then
brew install netcdf netcdf-cxx netcdf-fortran
echo "LIBRARY_PATH=/usr/local/lib/:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LDFLAGS=-L/usr/local/lib" >> $GITHUB_ENV
echo "INCLUDE=/usr/local/include" >> $GITHUB_ENV
echo "NETCDF=/usr/local" >> $GITHUB_ENV
fi
# Build and run noah executable
# noah-owp-modular's configure system has 5 options serving the need for different computer
# servers and OS environment. The numbers 5 is for Linux type computing enviroments.
# Using the Linux option for macOS as macOS could not find gfortran in /usr/local/bin/.
- name: Configure
run: |
if [ ${{ runner.os }} == 'Linux' ]
then
./configure 5
elif [ ${{ runner.os }} == 'macOS' ]
then
sudo ln -s $(which gfortran-13) /usr/local/bin/gfortran
./configure 5
fi
- name: Build and Run Standalone
run: |
make clean
make
cd run
./noah_owp_modular.exe namelist.input
- name: Build and Run BMI test
run: |
make clean
make testBMI
cd test
./noahowp_test.exe ../run/namelist.input