Adding new Feature/pavd #729
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
compiler: [gfortran-9, gfortran-10, gfortran-11] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libnetcdff-dev | |
- name: Set up Python (micromamba) | |
uses: mamba-org/provision-with-micromamba@v15 | |
with: | |
environment-file: python/environment.yml | |
cache-env: true | |
extra-specs: | | |
python=3.10 | |
- name: Check that default input is nc | |
run: | | |
f90nml -g filenames -v file_vars="'input/gfs.t12z.20220701.sfcf000.canopy.nc'" \ | |
input/namelist.canopy input/namelist.canopy | |
f90nml -g userdefs -v ntime=1 \ | |
input/namelist.canopy input/namelist.canopy | |
python -c ' | |
import f90nml | |
with open("input/namelist.canopy") as f: | |
nml = f90nml.read(f) | |
assert nml["filenames"]["file_vars"].endswith((".nc", ".ncf")), "nc input by default, like build" | |
assert nml["userdefs"]["infmt_opt"] == 0, "necessary to read 2-D" | |
' | |
- name: Debug compile and run | |
run: | | |
make -C src clean | |
make -C src | |
./canopy | |
env: | |
DEBUG: 1 | |
FC: ${{ matrix.compiler }} | |
- name: Run Python module as script | |
run: | | |
cd python | |
python canopy_app.py | |
cd - | |
- name: Run Python example nbs | |
run: | | |
cd python | |
for f in *.ipynb; do | |
jupyter nbconvert --to notebook --execute $f | |
done | |
cd - | |
- name: Non-debug compile and run | |
run: | | |
make -C src clean | |
make -C src | |
./canopy | |
env: | |
DEBUG: 0 | |
FC: ${{ matrix.compiler }} | |
- name: Non-NetCDF compile and run | |
run: | | |
make -C src clean | |
make -C src | |
f90nml -g filenames -v file_vars="'input/gfs.t12z.20220701.sfcf000.canopy.txt'" \ | |
input/namelist.canopy input/namelist.canopy | |
f90nml -g userdefs -v infmt_opt=1 \ | |
input/namelist.canopy input/namelist.canopy | |
./canopy | |
env: | |
DEBUG: 0 | |
FC: ${{ matrix.compiler }} | |
NETCDF: 0 |