Repository navigation
71 lines (62 loc) · 2.31 KB
/
Copy pathci.yml
File metadata and controls
71 lines (62 loc) · 2.31 KB
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
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
build-and-test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
gfortran: [11, 12]
steps:
- uses: actions/checkout@v4
- name: Install system compilers
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-${{ matrix.gfortran }} \
g++-${{ matrix.gfortran }} \
gfortran-${{ matrix.gfortran }} \
pkg-config cmake git python3
- name: Setup Spack
run: |
git clone --depth=1 https://github.com/spack/spack.git ~/spack
source ~/spack/share/spack/setup-env.sh
spack compiler find
spack compiler list
echo "SPACK_ROOT=$HOME/spack" >> $GITHUB_ENV
- name: Cache Spack packages
uses: actions/cache@v4
with:
path: |
~/spack/opt/spack
~/.spack
key: spack-ubuntu22-gcc${{ matrix.gfortran }}-${{ hashFiles('.github/workflows/ci.yml') }}
restore-keys: |
spack-ubuntu22-gcc${{ matrix.gfortran }}-
- name: Install dependencies via Spack
run: |
source ~/spack/share/spack/setup-env.sh
# Install dependencies with explicit compiler and reuse existing builds
spack install --reuse --no-check-signature \
kokkos@4.3.01+serial%gcc@${{ matrix.gfortran }}
spack install --reuse --no-check-signature \
hdf5@1.14+fortran~mpi%gcc@${{ matrix.gfortran }}
spack install --reuse --no-check-signature \
netcdf-fortran@4.6%gcc@${{ matrix.gfortran }}
- name: Configure (CMake)
run: |
source ~/spack/share/spack/setup-env.sh
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$(which gcc-${{ matrix.gfortran }}) \
-DCMAKE_CXX_COMPILER=$(which g++-${{ matrix.gfortran }}) \
-DCMAKE_Fortran_COMPILER=$(which gfortran-${{ matrix.gfortran }}) \
-DCMAKE_PREFIX_PATH="$(spack location -i kokkos);$(spack location -i hdf5);$(spack location -i netcdf-fortran)"
- name: Build
run: cmake --build build -j$(nproc)
- name: Test (CMake)
run: cd build && ctest --output-on-failure