32
32
# Also need to change build script to use spack from base image
33
33
submodules : true
34
34
35
+ # No GHCR base image with skopeo, so this will do...
36
+ - name : " Set up skopeo"
37
+
38
+ with :
39
+ version : latest
40
+
41
+ # Use skopeo to check for image for convenience
42
+ - name : Check for existing base images
43
+ run : |
44
+ set -e
45
+ CONTAINER_TAG=${{ env.BASE_VERSION }}
46
+ OCI_URL="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }}"
47
+ echo Checking for CONTAINER_TAG $CONTAINER_TAG
48
+ skopeo inspect \
49
+ docker://$OCI_URL \
50
+ --raw \
51
+ --creds "${{ env.USERNAME }}:${{ secrets.GITHUB_TOKEN }}" \
52
+ > /dev/null && echo "Image already exists. Please bump version." && exit 0
53
+ echo "IMAGE_EXISTS=false" >> $GITHUB_ENV
54
+
35
55
# Need to build custom base image with gfortran
36
56
- name : Create Dockerfile heredoc
57
+ if : ${{ env.IMAGE_EXISTS == 'false' }}
37
58
run : |
38
59
cat << EOF > Dockerfile
39
60
FROM ubuntu:24.04
@@ -61,13 +82,15 @@ jobs:
61
82
password : ${{ secrets.GITHUB_TOKEN }}
62
83
63
84
- name : Extract metadata (tags, labels) for Docker
85
+ if : ${{ env.IMAGE_EXISTS == 'false' }}
64
86
id : meta
65
87
uses : docker/metadata-action@v5
66
88
with :
67
89
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
68
90
labels : org.opencontainers.image.version=${{ env.BASE_VERSION }}
69
91
70
92
- name : Build and push Docker base image
93
+ if : ${{ env.IMAGE_EXISTS == 'false' }}
71
94
uses : docker/build-push-action@v5
72
95
with :
73
96
context : .
@@ -120,7 +143,6 @@ jobs:
120
143
concretizer:
121
144
reuse: dependencies
122
145
config:
123
- concretizer: clingo
124
146
source_cache: $SPACK_CACHE/source_cache
125
147
misc_cache: $SPACK_CACHE/misc_cache
126
148
build_stage: $SPACK_CACHE/build_stage
@@ -129,10 +151,11 @@ jobs:
129
151
padded_length: False
130
152
mirrors:
131
153
local-buildcache: oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
132
- spack: https://binaries.spack.io/develop
154
+ # spack: https://binaries.spack.io/develop
133
155
packages:
134
156
all:
135
157
require: "%gcc"
158
+ EOF
136
159
137
160
- name : Configure GHCR mirror
138
161
run : spack -e . mirror set --oci-username ${{ env.USERNAME }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
@@ -147,10 +170,13 @@ jobs:
147
170
run : spack -e . develop --path=$(pwd) exago@develop
148
171
149
172
- name : Concretize
150
- run : spack -e . concretize
173
+ run : spack -e . concretize --fresh
151
174
152
175
- name : Install
153
- run : spack -e . install --no-check-signature --fail-fast
176
+ run : spack -e . install --no-check-signature --fail-fast --keep-stage
177
+
178
+ - name : Test Build
179
+ run : cd $(spack -e . location --build-dir exago@develop) && ctest -VV
154
180
155
181
# Push with force to override existing binaries...
156
182
- name : Push to binaries to buildcache
0 commit comments