Testing for tocgrib2 #218
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
# This is a CI workflow for the NCEPLIBS-grib_util project. | |
# | |
# This workflow builds grib_util with Spack, including installing with the "--test | |
# root" option to run the CTest suite. 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: | |
# This job builds with Spack using every combination of variants and runs the CTest suite each time | |
Spack: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
openmp: ["+openmp", "~openmp"] | |
ip_spec: ["^[email protected]", "^[email protected] ^[email protected]"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: checkout-grib-util | |
uses: actions/checkout@v4 | |
with: | |
path: grib-util | |
- name: cache-spack | |
id: cache-spack | |
uses: actions/cache@v3 | |
with: | |
path: ~/spack-build-cache | |
key: spack-build-cache-${{ matrix.os }}-${{ matrix.ip_spec }}-1 | |
- name: spack-build-and-test | |
run: | | |
git clone -c feature.manyFiles=true https://github.com/spack/spack | |
. spack/share/spack/setup-env.sh | |
spack env create grib-util-env | |
spack env activate grib-util-env | |
cp $GITHUB_WORKSPACE/grib-util/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/grib-util/package.py | |
spack develop --no-clone --path $GITHUB_WORKSPACE/grib-util grib-util@develop | |
spack add grib-util@develop%gcc@11 ${{ matrix.openmp }} ^[email protected] ^[email protected] ^g2@develop ^g2c@develop +utils +build_v2_api ${{ matrix.ip_spec }} | |
spack external find cmake gmake | |
spack mirror add spack-build-cache ~/spack-build-cache | |
spack concretize | |
# Run installation and run CTest suite | |
spack install --fail-fast --no-check-signature --test root | |
# Print test results | |
cat $(spack location -i grib-util)/.spack/install-time-test-log.txt | |
# Run 'spack load' to check for obvious errors in setup_run_environment | |
echo "Loading grib-util through Spack..." | |
spack load grib-util | |
spack buildcache push --only dependencies --unsigned ~/spack-build-cache grib-util | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: spackci-ctest-output-${{ matrix.os }}-${{ matrix.openmp }} | |
path: ${{ github.workspace }}/grib-util/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-grib-util | |
uses: actions/checkout@v4 | |
with: | |
path: grib-util | |
- 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|FTP_TEST_FILES|FTP_LARGE_TEST_FILES|FTP_EXTRA_TEST_FILES))[^ ]+' $GITHUB_WORKSPACE/grib-util/CMakeLists.txt) ; do | |
echo "Checking for presence of '$opt' CMake option in package.py" | |
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/grib-util/spack/package.py | |
done |