Update for g2_gribend.c #171
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-g2c project. | |
# | |
# This workflow builds g2c 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"] | |
variants: ["libs=shared +aec+png+jasper~openjpeg+pic+pthreads+utils+build_g2c", "libs=static ~aec~png~jasper+openjpeg~pic~pthreads~utils~build_g2c"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: checkout-g2c | |
uses: actions/checkout@v4 | |
with: | |
path: g2c | |
- name: cache-spack | |
id: cache-spack | |
uses: actions/cache@v3 | |
with: | |
path: ~/spack-build-cache | |
key: spack-build-cache-${{ matrix.os }}-${{ matrix.variants }}-1 | |
- name: spack-build-and-test | |
run: | | |
set -x | |
git clone -c feature.manyFiles=true https://github.com/spack/spack | |
. spack/share/spack/setup-env.sh | |
spack env create g2c-env | |
spack env activate g2c-env | |
cp $GITHUB_WORKSPACE/g2c/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/g2c/package.py | |
spack develop --no-clone --path $GITHUB_WORKSPACE/g2c g2c@develop | |
spack add g2c@develop%gcc@11 ${{ matrix.variants }} | |
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 g2c)/.spack/install-time-test-log.txt | |
# Run 'spack load' to check for obvious errors in setup_run_environment | |
echo 'Loading g2c through Spack and checking $G2C_LIB ...' | |
spack load g2c | |
if [[ "${{ matrix.variants }}" =~ "libs=shared" ]]; then suffix="so" ; else suffix="a"; fi | |
ls $G2C_LIB | grep -cE '/libg2c\.'$suffix'$' | |
if [[ "${{ matrix.variants }}" == *"+png"* && "${{ matrix.variants }}" == "libs=shared"* ]]; then ldd $G2C_LIB | grep -c libpng; fi | |
if [[ "${{ matrix.variants }}" == *"+utils"* ]]; then | |
ls $(spack location -i g2c)/bin/{g2c_compare,g2c_degrib2,g2c_index} | |
else | |
if [ -f $(spack location -i g2c)/bin/g2c_compare ]; then echo "utils were built but shouldn't have been!"; exit 1; fi | |
fi | |
# Setup build cache (automatically skipped if it already exists) | |
spack buildcache push --only dependencies --unsigned ~/spack-build-cache g2c | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: spackci-ctest-output-${{ matrix.os }}-${{ matrix.variants }} | |
path: ${{ github.workspace }}/g2c/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-g2c | |
uses: actions/checkout@v4 | |
with: | |
path: g2c | |
- 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" | |
excl="ENABLE_DOCS|FTP_TEST_FILES|FTP_LARGE_TEST_FILES|FTP_EXTRA_TEST_FILES|LOGGING" | |
for opt in $(grep -ioP "^option\(\K(?!($excl))[^ ]+" $GITHUB_WORKSPACE/g2c/CMakeLists.txt) ; do | |
echo "Checking for presence of '$opt' CMake option in package.py" | |
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/g2c/spack/package.py | |
done |