-
Notifications
You must be signed in to change notification settings - Fork 9
75 lines (67 loc) · 2.8 KB
/
Spack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This is a CI workflow for the NCEPLIBS-ip project.
#
# This workflow builds ip 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: ["+openmp +shared +pic precision=d", "+openmp ~shared ~pic precision=4", "~openmp ~shared +pic precision=8"]
runs-on: ${{ matrix.os }}
steps:
- name: checkout-ip
uses: actions/checkout@v4
with:
path: ip
- name: spack-build-and-test
run: |
sudo apt install libopenblas-serial-dev
git clone -c feature.manyFiles=true https://github.com/spack/spack
. spack/share/spack/setup-env.sh
spack env create ip-env
spack env activate ip-env
cp $GITHUB_WORKSPACE/ip/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/ip/package.py
spack develop --no-clone --path $GITHUB_WORKSPACE/ip ip@develop
spack add ip@develop%gcc@11 ${{ 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 external find --path /usr/lib/x86_64-linux-gnu/openblas-serial openblas
spack config add "packages:lapack:buildable:false"
spack concretize
# Run installation and run CTest suite
spack install --fail-fast --test root
# Run 'spack load' and check that key build options were respected
spack load ip
if [[ "${{ matrix.variants }}" =~ "+shared" ]]; then suffix="so" ; else suffix="a"; fi
libvar=IP_LIB${precision}
ls ${!libvar} | grep -cE "/libip_${precision}\."$suffix'$'
# This job validates the Spack recipe by making sure each cmake build option is represented
recipe-check:
runs-on: ubuntu-latest
steps:
- name: checkout-ip
uses: actions/checkout@v4
with:
path: ip
- 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/ip/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/ip/spack/package.py
done