Skip to content

Commit 1054c8b

Browse files
Add dependency installation for workflows via spack
1 parent fe2989c commit 1054c8b

File tree

5 files changed

+68
-234
lines changed

5 files changed

+68
-234
lines changed

.github/workflows/linux-gnu-cmake.yml

+24-30
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,11 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
include:
28-
# Linux
29-
- os: ubuntu-22.04
30-
fcompiler: gfortran-9
31-
ccompiler: gcc-9
32-
shell: bash
33-
build_type: coverage
34-
memcheck: true
35-
36-
- os: ubuntu-22.04
37-
fcompiler: gfortran-9
38-
ccompiler: gcc-9
39-
shell: bash
40-
build_type: debug
41-
memcheck: false
42-
43-
- os: ubuntu-22.04
44-
fcompiler: gfortran-10
45-
ccompiler: gcc-10
46-
shell: bash
47-
build_type: debug
48-
memcheck: false
49-
50-
- os: ubuntu-22.04
51-
fcompiler: gfortran-11
52-
ccompiler: gcc-11
53-
shell: bash
54-
build_type: debug
55-
memcheck: false
56-
5728
- os: ubuntu-22.04
5829
fcompiler: gfortran-12
5930
ccompiler: gcc-12
31+
spack_compiler: [email protected]
32+
spack_os: "ubuntu:22.04"
6033
shell: bash
6134
build_type: debug
6235
memcheck: false
@@ -69,14 +42,29 @@ jobs:
6942
- name: Checkout repository
7043
uses: actions/checkout@v3
7144

72-
7345
- name: Show version information
7446
run: |
7547
${{ matrix.fcompiler }} --version
7648
${{ matrix.ccompiler }} --version
7749
50+
- name: Set up Spack
51+
uses: spack/setup-spack@v2
52+
with:
53+
ref: develop # Spack version (examples: develop, releases/v0.21)
54+
buildcache: true # Configure oci://ghcr.io/spack/github-actions-buildcache
55+
color: true # Force color output (SPACK_COLOR=always)
56+
path: spack # Where to clone Spack
57+
58+
- name: Install dependencies in spack environment
59+
run: |
60+
# set the compiler to use for builds
61+
spack compiler find
62+
spack config add packages:all:compiler:[${{ matrix.spack_compiler }}]
63+
spack -e . install --no-check-signature
64+
7865
- name: Build with Cmake
7966
run: |
67+
spack env activate .
8068
mkdir build
8169
cd build
8270
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../
@@ -123,5 +111,11 @@ jobs:
123111
echo $f
124112
valgrind --undef-value-errors=no --error-exitcode=1 -s $f -A
125113
done
114+
115+
- name: Push packages and update index
116+
run: |
117+
spack -e . mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
118+
spack -e . buildcache push --base-image ${{ matrix.spack_os }} --update-index local-buildcache
119+
if: ${{ !cancelled() }}
126120

127121

.github/workflows/linux-intel-cmake.yml

-132
This file was deleted.

.github/workflows/windows-gnu-cmake.yml

-72
This file was deleted.

fprettify.config

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
disable-indent-mod=False
2+
enable-replacements=False
3+
c-relations=False
4+
5+
# White space settings
6+
indent=2
7+
line-length=132
8+
strict-indent=True
9+
strip-comments=True
10+
whitespace-relational=True
11+
whitespace-logical=True
12+
whitespace-plusminus=False
13+
whitespace-multdiv=False
14+
whitespace-comma=False
15+
whitespace-intrinsics=False
16+
whitespace-print=False
17+
whitespace-type=False
18+
19+
# Control whitespace around '::' declarations
20+
whitespace-decl=None
21+
enable-decl=False
22+
23+
# Don't indent pre-processor statements
24+
disable-fypp=True

spack.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
spack:
2+
view: /opt/view
3+
specs:
4+
5+
6+
- [email protected] +fortran +mpi
7+
8+
config:
9+
install_tree:
10+
root: /opt/spack
11+
padded_length: 128
12+
13+
packages:
14+
all:
15+
require: 'target=x86_64_v3'
16+
17+
mirrors:
18+
local-buildcache:
19+
url: oci://ghcr.io/fluidnumerics/spack-buildcache
20+
signed: false

0 commit comments

Comments
 (0)