-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46a49b5
commit fafd040
Showing
3 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# This is a CI workflow for the NCEPLIBS-wrf_io project. | ||
# | ||
# This workflow builds wrf_io with Spack. 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, Nov 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-wrf-io | ||
uses: actions/checkout@v4 | ||
with: | ||
path: wrf-io | ||
|
||
- name: cache-spack | ||
id: cache-spack | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/spack-build-cache | ||
key: spack-build-cache-${{ matrix.os }}-1 | ||
|
||
- name: spack-build-and-test | ||
run: | | ||
cd | ||
git clone -c feature.manyFiles=true https://github.com/jcsda/spack | ||
. spack/share/spack/setup-env.sh | ||
spack env create wrf-io-env | ||
spack env activate wrf-io-env | ||
cp $GITHUB_WORKSPACE/wrf-io/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/wrf-io/package.py | ||
spack develop --no-clone --path $GITHUB_WORKSPACE/wrf-io wrf-io@develop | ||
spack add wrf-io@develop%gcc@11 ^netcdf-c ~blosc ~szip ~mpi ^hdf5~mpi | ||
spack external find cmake gmake openmpi | ||
spack config add "packages:openmpi:buildable:false" | ||
for mirror in $(spack mirror list | awk '{print $1}'); do | ||
spack mirror rm --scope defaults ${mirror} | ||
done | ||
spack mirror add spack-build-cache ~/spack-build-cache | ||
spack concretize | ||
# Run installation and run CTest suite | ||
if [ "${{ steps.cache.outputs.cache-hit }}" == true ]; then deps=only; else deps=auto; fi | ||
spack install --verbose --fail-fast --no-check-signature --use-buildcache package:never,dependencies:${deps} --test root | ||
spack buildcache push --only dependencies --unsigned --allow-root ~/spack-build-cache wrf-io | ||
- name: Upload test results | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: spackci-ctest-output-${{ matrix.os }}-${{ matrix.openmp }} | ||
path: ${{ github.workspace }}/wrf-io/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-wrf-io | ||
uses: actions/checkout@v4 | ||
with: | ||
path: wrf-io | ||
|
||
- 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))[^ ]+' $GITHUB_WORKSPACE/wrf-io/CMakeLists.txt) ; do | ||
echo "Checking for presence of '$opt' CMake option in package.py" | ||
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/wrf-io/spack/package.py | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This directory contains an authoritative, up-to-date Spack recipe for NCEPLIBS-wrf_io, which is found under Spack as "wrf-io". | ||
|
||
Before each release of NCEPLIBS-wrf_io, this file should be updated to accommodate changes in build options, etc., and .github/workflows/spack.yml should be updated to exercise all variants. Only the version entry should need to be updated after the release prior to incorporation into the Spack repository and the JCSDA Spack fork. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
from spack.package import * | ||
|
||
|
||
class WrfIo(CMakePackage): | ||
"""The WRFIO package is a lightweight WRF-IO API library for Unified | ||
Post Processor (UPP). It reads wrf forecasts (WRF state plus | ||
diagnostics). | ||
This is part of the NCEPLIBS project.""" | ||
|
||
homepage = "https://noaa-emc.github.io/NCEPLIBS-wrf_io" | ||
url = "https://github.com/NOAA-EMC/NCEPLIBS-wrf_io/archive/refs/tags/v1.2.0.tar.gz" | ||
git = "https://github.com/NOAA-EMC/NCEPLIBS-wrf_io" | ||
|
||
maintainers("AlexanderRichert-NOAA", "Hang-Lei-NOAA", "edwardhartnett") | ||
|
||
version("develop", branch="develop") | ||
version("1.2.0", sha256="000cf5294a2c68460085258186e1f36c86d3d0d9c433aa969a0f92736b745617") | ||
|
||
variant("openmp", default=False, description="Enable multithreading with OpenMP") | ||
|
||
depends_on("netcdf-c") | ||
depends_on("netcdf-fortran") | ||
|
||
def cmake_args(self): | ||
args = [self.define_from_variant("OPENMP", "openmp")] | ||
return args |