Merge pull request #30 from AlexanderRichert-NOAA/ci_updates_nov2023 #2
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
# This is a CI workflow for the NCEPLIBS-landsfcutil project. | |
# | |
# This workflow builds landsfcutil with Spack, including installing with the "--test | |
# root" option to run the pFunit test. 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, Sep 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-landsfcutil | |
uses: actions/checkout@v4 | |
with: | |
path: landsfcutil | |
- name: spack-build-and-test | |
run: | | |
git clone -c feature.manyFiles=true https://github.com/jcsda/spack | |
. spack/share/spack/setup-env.sh | |
spack env create landsfcutil-env | |
spack env activate landsfcutil-env | |
cp $GITHUB_WORKSPACE/landsfcutil/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/landsfcutil/package.py | |
spack develop --no-clone --path $GITHUB_WORKSPACE/landsfcutil landsfcutil@develop | |
spack add landsfcutil@develop%gcc@11 +pfunit | |
spack external find cmake gmake m4 python | |
spack concretize | |
# Run installation and run pFunit testing | |
spack install --verbose --fail-fast --test root | |
# Run 'spack load' to check for obvious errors in setup_run_environment | |
spack load landsfcutil | |
ls $LANDSFCUTIL_LIB | |
ls $LANDSFCUTIL_LIB4 | |
# This job validates the Spack recipe by making sure each cmake build option is represented | |
recipe-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout-landsfcutil | |
uses: actions/checkout@v4 | |
with: | |
path: landsfcutil | |
- 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(?!(DUMMY_ENTRY))[^ ]+' $GITHUB_WORKSPACE/landsfcutil/CMakeLists.txt) ; do | |
echo "Checking for presence of '$opt' CMake option in package.py" | |
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/landsfcutil/spack/package.py | |
done |