|
| 1 | +name: io_gnu |
| 2 | +on: [push, pull_request, workflow_dispatch] |
| 3 | + |
| 4 | +# Cancel in-progress workflows when pushing to a branch |
| 5 | +concurrency: |
| 6 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +env: |
| 10 | + cache_key: gnu11 |
| 11 | + CC: gcc-10 |
| 12 | + FC: gfortran-10 |
| 13 | + CXX: g++-10 |
| 14 | + |
| 15 | + |
| 16 | +# Split into a steup step, and a WW3 build step which |
| 17 | +# builds multiple switches in a matrix. The setup is run once and |
| 18 | +# the environment is cached so each build of WW3 can share the dependencies. |
| 19 | + |
| 20 | +jobs: |
| 21 | + setup: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: checkout-ww3 |
| 26 | + if: steps.cache-env.outputs.cache-hit != 'true' |
| 27 | + uses: actions/checkout@v3 |
| 28 | + with: |
| 29 | + path: ww3 |
| 30 | + # Cache spack, OASIS, and compiler |
| 31 | + # No way to flush Action cache, so key may have # appended |
| 32 | + - name: cache-env |
| 33 | + id: cache-env |
| 34 | + uses: actions/cache@v3 |
| 35 | + with: |
| 36 | + path: | |
| 37 | + spack |
| 38 | + ~/.spack |
| 39 | + work_oasis3-mct |
| 40 | + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }} |
| 41 | + |
| 42 | + # Build WW3 spack environment |
| 43 | + - name: install-dependencies-with-spack |
| 44 | + if: steps.cache-env.outputs.cache-hit != 'true' |
| 45 | + run: | |
| 46 | + # Install NetCDF, ESMF, g2, etc using Spack |
| 47 | + sudo apt install cmake |
| 48 | + git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git |
| 49 | + source spack/share/spack/setup-env.sh |
| 50 | + spack env create ww3-gnu ww3/model/ci/spack_gnu.yaml |
| 51 | + spack env activate ww3-gnu |
| 52 | + spack compiler find |
| 53 | + spack external find cmake |
| 54 | + spack add mpich@3.4.2 |
| 55 | + spack concretize |
| 56 | + spack install --dirty -v |
| 57 | +
|
| 58 | + - name: build-oasis |
| 59 | + if: steps.cache-env.outputs.cache-hit != 'true' |
| 60 | + run: | |
| 61 | + source spack/share/spack/setup-env.sh |
| 62 | + spack env activate ww3-gnu |
| 63 | + export WWATCH3_DIR=${GITHUB_WORKSPACE}/ww3/model |
| 64 | + export OASIS_INPUT_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/oasis3-mct |
| 65 | + export OASIS_WORK_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct |
| 66 | + cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir |
| 67 | + cmake . |
| 68 | + make VERBOSE=1 |
| 69 | + cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct ${GITHUB_WORKSPACE} |
| 70 | +
|
| 71 | + io_gnu: |
| 72 | + needs: setup |
| 73 | + runs-on: ubuntu-latest |
| 74 | + |
| 75 | + steps: |
| 76 | + - name: checkout-ww3 |
| 77 | + uses: actions/checkout@v3 |
| 78 | + with: |
| 79 | + path: ww3 |
| 80 | + |
| 81 | + - name: cache-env |
| 82 | + id: cache-env |
| 83 | + uses: actions/cache@v3 |
| 84 | + with: |
| 85 | + path: | |
| 86 | + spack |
| 87 | + ~/.spack |
| 88 | + work_oasis3-mct |
| 89 | + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }} |
| 90 | + |
| 91 | + - name: build-ww3 |
| 92 | + run: | |
| 93 | + source spack/share/spack/setup-env.sh |
| 94 | + spack env activate ww3-gnu |
| 95 | + cd ww3 |
| 96 | + export CC=mpicc |
| 97 | + export FC=mpif90 |
| 98 | + export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct |
| 99 | + mkdir build && cd build |
| 100 | + cmake .. -DSWITCH=${GITHUB_WORKSPACE}/model/tests/data/switch.io |
| 101 | + make -j2 VERBOSE=1 |
| 102 | + ctest --verbose --output-on-failure --rerun-failed |
0 commit comments