Skip to content

Update VERSION

Update VERSION #54

Workflow file for this run

# This is a CI workflow for the NCEPLIBS-sp project.
#
# This workflow builds sp 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"]
variants: ["+shared +pic precision=4", "~shared ~pic precision=d", "~shared +pic precision=8"]
runs-on: ${{ matrix.os }}
steps:
- name: checkout-sp
uses: actions/checkout@v4
with:
path: sp
- 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 sp-env
spack env activate sp-env
cp $GITHUB_WORKSPACE/sp/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/sp/package.py
spack develop --no-clone --path $GITHUB_WORKSPACE/sp sp@develop
spack add sp@develop%gcc@11 ${{ matrix.openmp }} ${{ matrix.variants }}
spack add ip@develop ${{ matrix.variants }} target=x86_64
precision=$(echo ${{ matrix.variants }} | grep -oP " precision=\K[4d8]")
if [ "$precision" == "d" ]; then spack add grib-util@develop ; fi
spack external find cmake gmake
spack concretize
# Run installation and run CTest suite
spack install --verbose --fail-fast --test root
# Print test results
cat $(spack location -i sp)/.spack/install-time-test-log.txt
cat $(spack location -i ip)/.spack/install-time-test-log.txt
if [ "$precision" == "d" ]; then
cat $(spack location -i grib-util)/.spack/install-time-test-log.txt
fi
# Run 'spack load' and check that key build options were respected
spack load sp
if [[ "${{ matrix.variants }}" =~ "+shared" ]]; then suffix="so" ; else suffix="a"; fi
libvar=SP_LIB${precision}
ls ${!libvar} | grep -cE "/libsp_${precision}\."$suffix'$'
- name: Upload test results
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: spackci-ctest-output-${{ matrix.os }}-${{ matrix.openmp }}-${{ matrix.variants }}
path: ${{ github.workspace }}/*/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-sp
uses: actions/checkout@v4
with:
path: sp
- 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|TEST_TIME_LIMIT))[^ ]+' $GITHUB_WORKSPACE/sp/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/sp/spack/package.py
done