diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml new file mode 100644 index 00000000..665c0cda --- /dev/null +++ b/.github/workflows/Spack.yml @@ -0,0 +1,53 @@ +# 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: ["^ip@5.0.0", "^ip@4.2.0 ^sp@2.4.0"] + runs-on: ${{ matrix.os }} + + steps: + + - name: "Build Spack package" + uses: NOAA-EMC/ci-test-spack-package@develop + with: + package-name: grib-util + package-variants: +tests ${{ matrix.openmp }} ^bacio@2.6.0 ^w3emc@2.10.0 ^g2@develop ^g2c@develop +utils +build_v2_api ${{ matrix.ip_spec }} + custom-recipe: spack/package.py + use-repo-cache: true + spack-compiler: gcc + repo-cache-key-suffix: ${{ matrix.os }}-${{ matrix.openmp }}-${{ matrix.ip_spec }}-1 + + + # This job validates the Spack recipe by making sure each cmake build option is represented + recipe-check: + runs-on: ubuntu-latest + + steps: + + - name: recipe-check + uses: NOAA-EMC/ci-check-spack-recipe@develop + with: + recipe-file: package/spack/package.py + cmakelists-txt: package/CMakeLists.txt + ignore-list: ENABLE_DOCS,FTP_TEST_FILES,FTP_LARGE_TEST_FILES,FTP_EXTRA_TEST_FILES diff --git a/.github/workflows/Spack.yml.old b/.github/workflows/Spack.yml.old deleted file mode 100644 index 9fd39105..00000000 --- a/.github/workflows/Spack.yml.old +++ /dev/null @@ -1,88 +0,0 @@ -# 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: ["^ip@5.0.0", "^ip@4.2.0 ^sp@2.4.0"] - 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 }} ^bacio@2.6.0 ^w3emc@2.10.0 ^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