feature: ufs replay tarball moved to release assett #1004
Workflow file for this run
This file contains hidden or 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: build and run SCM regression tests | |
| on: | |
| push: | |
| branches: [main] # add artifact to main branch | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| run_scm_rts: | |
| # Don't run in forks | |
| if: github.repository == 'NCAR/ccpp-scm' | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| fortran-compiler: [12] | |
| build-type: [Release, Debug, SinglePrecision] | |
| py-version: [3.11] | |
| continue-on-error: true | |
| # Environmental variables | |
| env: | |
| NFHOME: /home/runner/netcdf-fortran | |
| NFVERSION: v4.5.3 | |
| bacio_ROOT: /home/runner/bacio | |
| sp_ROOT: /home/runner/NCEPLIBS-sp | |
| w3emc_ROOT: /home/runner/myw3emc | |
| SCM_ROOT: /home/runner/work/ccpp-scm/ccpp-scm | |
| suites: SCM_GFS_v15p2,SCM_GFS_v15p2_ntiedtke,SCM_GFS_v16,SCM_GFS_v17_p8,SCM_HRRR,SCM_RRFS_v1beta,SCM_RAP,SCM_WoFS_v0,SCM_HRRR_gf,SCM_GFS_v17_p8_ugwpv1,SCM_GFS_v16_RRTMGP,SCM_GFS_v16_debug,SCM_GFS_v16_no_nsst,SCM_GFS_v17_p8_ugwpv1_no_nsst,SCM_RRFS_v1beta_no_nsst,SCM_GFS_v16_gfdlmpv3,SCM_GFS_v17_p8_ugwpv1_tempo | |
| suites_ps: SCM_GFS_v15p2_ps,SCM_GFS_v15p2_ntiedtke_ps,SCM_GFS_v16_ps,SCM_GFS_v17_p8_ps,SCM_HRRR_ps,SCM_RRFS_v1beta_ps,SCM_RAP_ps,SCM_WoFS_v0_ps,SCM_HRRR_gf_ps,SCM_GFS_v17_p8_ugwpv1_ps,SCM_GFS_v16_RRTMGP_ps,SCM_GFS_v16_debug_ps,SCM_GFS_v16_no_nsst_ps,SCM_GFS_v17_p8_ugwpv1_no_nsst_ps,SCM_RRFS_v1beta_no_nsst_ps,SCM_GFS_v16_gfdlmpv3_ps,SCM_GFS_v17_p8_ugwpv1_tempo_ps | |
| dir_rt: /home/runner/work/ccpp-scm/ccpp-scm/test/artifact-${{matrix.build-type}} | |
| dir_bl: /home/runner/work/ccpp-scm/ccpp-scm/test/BL-${{matrix.build-type}} | |
| artifact_origin: ${{ github.event_name == 'pull_request' && 'PR' || ('main' == 'main' && 'main' || 'PR') }} | |
| GH_TOKEN: ${{ github.token }} | |
| # Workflow steps | |
| steps: | |
| # Install System Dependencies | |
| - name: Install System Dependencies | |
| run: | | |
| sudo apt-get update -qq && sudo apt-get install -qq -y --no-install-recommends \ | |
| gfortran-${{matrix.fortran-compiler}} \ | |
| libhdf5-dev \ | |
| libnetcdf-pnetcdf-19 \ | |
| libnetcdff7 \ | |
| libnetcdf-dev \ | |
| libnetcdff-dev \ | |
| libxml2 \ | |
| openmpi-bin \ | |
| libopenmpi-dev | |
| # Python setup | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{matrix.py-version}} | |
| - name: Install NetCDF Python libraries | |
| run: | | |
| pip install f90nml h5py netCDF4 matplotlib | |
| - name: Environment for openmpi compiler | |
| run: | | |
| echo "FC=mpif90" >> $GITHUB_ENV | |
| echo "CC=mpicc" >> $GITHUB_ENV | |
| - name: Check MPI version | |
| run: | | |
| which mpif90 | |
| mpif90 --version | |
| # Install NCEP libs | |
| - name: Cache bacio library v2.4.1 | |
| id: cache-bacio-fortran | |
| uses: actions/cache@v5 | |
| with: | |
| path: /home/runner/bacio | |
| key: cache-bacio-fortran-${{matrix.fortran-compiler}}-${{matrix.build-type}}-key | |
| - name: Install bacio library v2.4.1 | |
| if: steps.cache-bacio-fortran.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --branch v2.4.1 https://github.com/NOAA-EMC/NCEPLIBS-bacio.git bacio | |
| cd bacio && mkdir build && cd build | |
| cmake -DCMAKE_INSTALL_PREFIX=${bacio_ROOT} ../ | |
| make -j2 | |
| make install | |
| echo "bacio_DIR=/home/runner/bacio/lib/cmake/bacio" >> $GITHUB_ENV | |
| - name: Cache SP-library v2.3.3 | |
| id: cache-sp-fortran | |
| uses: actions/cache@v5 | |
| with: | |
| path: /home/runner/NCEPLIBS-sp | |
| key: cache-sp-fortran-${{matrix.fortran-compiler}}-${{matrix.build-type}}-key | |
| - name: Install SP-library v2.3.3 | |
| if: steps.cache-sp-fortran.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --branch v2.3.3 https://github.com/NOAA-EMC/NCEPLIBS-sp.git NCEPLIBS-sp | |
| cd NCEPLIBS-sp && mkdir build && cd build | |
| cmake -DCMAKE_INSTALL_PREFIX=${sp_ROOT} ../ | |
| make -j2 | |
| make install | |
| echo "sp_DIR=/home/runner/NCEPLIBS-sp/lib/cmake/sp" >> $GITHUB_ENV | |
| - name: Cache w3emc library v2.9.2 | |
| id: cache-w3emc-fortran | |
| uses: actions/cache@v5 | |
| with: | |
| path: /home/runner/myw3emc | |
| key: cache-w3emc-fortran-${{matrix.fortran-compiler}}-${{matrix.build-type}}-key | |
| - name: Install w3emc library v2.9.2 | |
| if: steps.cache-w3emc-fortran.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --branch v2.9.2 https://github.com/NOAA-EMC/NCEPLIBS-w3emc.git NCEPLIBS-w3emc | |
| cd NCEPLIBS-w3emc && mkdir build && cd build | |
| cmake -DCMAKE_INSTALL_PREFIX=${w3emc_ROOT} ../ | |
| make -j2 | |
| make install | |
| echo "w3emc_DIR=/home/runner/myw3emc/lib/cmake/w3emc" >> $GITHUB_ENV | |
| # Initialize and build SCM, run regressions tests | |
| - name: Checkout SCM code (into /home/runner/work/ccpp-scm/) | |
| uses: actions/checkout@v6 | |
| - name: Initialize submodules | |
| run: git submodule update --init --recursive | |
| - name: Download data for SCM | |
| run: | | |
| cd ${SCM_ROOT} | |
| ./contrib/get_all_static_data.sh | |
| ./contrib/get_thompson_tables.sh | |
| ./contrib/get_tempo_data.sh | |
| ./contrib/get_aerosol_climo.sh | |
| ./contrib/get_rrtmgp_data.sh | |
| - name: Configure build with CMake (Release) | |
| if: contains(matrix.build-type, 'Release') | |
| run: | | |
| cd ${SCM_ROOT}/scm | |
| mkdir bin && cd bin | |
| cmake -DCCPP_SUITES=${suites},${suites_ps} ../src | |
| - name: Configure build with CMake (Debug) | |
| if: contains(matrix.build-type, 'Debug') | |
| run: | | |
| cd ${SCM_ROOT}/scm | |
| mkdir bin && cd bin | |
| cmake -DCCPP_SUITES=${suites},${suites_ps} -DCMAKE_BUILD_TYPE=Debug ../src | |
| - name: Configure build with CMake (Single Precision) | |
| if: matrix.build-type == 'SinglePrecision' | |
| run: | | |
| cd ${SCM_ROOT}/scm | |
| mkdir bin && cd bin | |
| cmake -DCCPP_SUITES=${suites},${suites_ps} -D32BIT=1 ../src | |
| - name: Build SCM | |
| run: | | |
| cd ${SCM_ROOT}/scm/bin | |
| make -j4 | |
| - name: Run SCM RTs | |
| if: matrix.build-type != 'SinglePrecision' | |
| run: | | |
| cd ${SCM_ROOT}/scm/bin | |
| ./run_scm.py --file /home/runner/work/ccpp-scm/ccpp-scm/test/rt_test_cases.py --runtime_mult 0.1 | |
| - name: Run SCM Single Precision RTs | |
| if: matrix.build-type == 'SinglePrecision' | |
| run: | | |
| cd ${SCM_ROOT}/scm/bin | |
| ./run_scm.py --file /home/runner/work/ccpp-scm/ccpp-scm/test/rt_test_cases_sp.py --runtime_mult 0.1 | |
| - name: Gather SCM RT output | |
| run: | | |
| cd ${SCM_ROOT}/test | |
| mkdir /home/runner/work/ccpp-scm/ccpp-scm/test/artifact-${{matrix.build-type}} | |
| ./ci_util.py -b ${{matrix.build-type}} | |
| - name: Save Artifact Id Numbers and Create Directory for SCM RT baselines | |
| run: | | |
| mkdir -p ${dir_bl} | |
| ARTIFACT_ID=$(gh api --paginate \ | |
| repos/NCAR/ccpp-scm/actions/artifacts | \ | |
| jq -s '[ .[] | .artifacts[] | select(.name == "rt-baselines-${{matrix.build-type}}-main" and (.expired | not))] | sort_by(.created_at) | last | .workflow_run | .id ') | |
| echo "artifact_id=${ARTIFACT_ID}" | |
| echo "artifact_id=${ARTIFACT_ID}" >> "$GITHUB_ENV" | |
| - name: Download SCM RT baselines | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: rt-baselines-${{matrix.build-type}}-main | |
| path: ${{ env.dir_bl }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ env.artifact_id }} | |
| - name: Compare SCM RT output to baselines | |
| run: | | |
| cd ${SCM_ROOT}/test | |
| ./cmp_rt2bl.py --dir_rt ${dir_rt} --dir_bl ${dir_bl} | |
| - name: Check if SCM RT plots exist | |
| id: check_files | |
| run: | | |
| if [ -n "$(ls -A /home/runner/work/ccpp-scm/ccpp-scm/test/scm_rt_out 2>/dev/null)" ]; then | |
| echo "files_exist=true" >> "$GITHUB_ENV" | |
| else | |
| echo "files_exist=false" >> "$GITHUB_ENV" | |
| fi | |
| - name: Upload plots of SCM Baselines/RTs as GitHub Artifact. | |
| if: env.files_exist == 'true' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: rt-plots-${{matrix.build-type}}-${{ env.artifact_origin }} | |
| path: /home/runner/work/ccpp-scm/ccpp-scm/test/scm_rt_out | |
| - name: Upload SCM RTs as GitHub Artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: rt-baselines-${{matrix.build-type}}-${{ env.artifact_origin }} | |
| path: /home/runner/work/ccpp-scm/ccpp-scm/test/artifact-${{matrix.build-type}} |