Skip to content

Merge pull request #42 from AlexanderRichert-NOAA/ci_uppates_nov2023 #5

Merge pull request #42 from AlexanderRichert-NOAA/ci_uppates_nov2023

Merge pull request #42 from AlexanderRichert-NOAA/ci_uppates_nov2023 #5

Workflow file for this run

# This is a CI workflow for the NCEPLIBS-wrf_io project.
#
# This workflow builds wrf_io with Spack. It also has a one-off job that
# validates the recipe by ensuring that every CMake option that should be set
# in the Spack recipe is so set.
#
# Alex Richert, Nov 2023
name: Spack
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
Spack:
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: checkout-wrf-io
uses: actions/checkout@v4
with:
path: wrf-io
- name: cache-spack
id: cache-spack
uses: actions/cache@v3
with:
path: ~/spack-build-cache
key: spack-build-cache-${{ matrix.os }}-1
- name: spack-build-and-test
run: |
cd
git clone -c feature.manyFiles=true https://github.com/jcsda/spack
. spack/share/spack/setup-env.sh
spack env create wrf-io-env
spack env activate wrf-io-env
cp $GITHUB_WORKSPACE/wrf-io/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/wrf-io/package.py
spack develop --no-clone --path $GITHUB_WORKSPACE/wrf-io wrf-io@develop
spack add wrf-io@develop%gcc@11 ^netcdf-c ~blosc ~szip ~mpi ^hdf5~mpi
spack external find cmake gmake openmpi
spack config add "packages:openmpi:buildable:false"
for mirror in $(spack mirror list | awk '{print $1}'); do
spack mirror rm --scope defaults ${mirror}
done
spack mirror add spack-build-cache ~/spack-build-cache
spack concretize
# Run installation and run CTest suite
if [ "${{ steps.cache.outputs.cache-hit }}" == true ]; then deps=only; else deps=auto; fi
spack install --verbose --fail-fast --no-check-signature --use-buildcache package:never,dependencies:${deps} --test root
spack buildcache push --only dependencies --unsigned --allow-root ~/spack-build-cache wrf-io
- name: Upload test results
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: spackci-ctest-output-${{ matrix.os }}-${{ matrix.openmp }}
path: ${{ github.workspace }}/wrf-io/spack-build-*/Testing/Temporary/LastTest.log
# This job validates the Spack recipe by making sure each cmake build option is represented
recipe-check:
runs-on: ubuntu-latest
steps:
- name: checkout-wrf-io
uses: actions/checkout@v4
with:
path: wrf-io
- name: recipe-check
run: |
echo "If this jobs fails, look at the most recently output CMake option below and make sure that option appears in spack/package.py"
for opt in $(grep -ioP '^option\(\K(?!(ENABLE_DOCS))[^ ]+' $GITHUB_WORKSPACE/wrf-io/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/wrf-io/spack/package.py
done