1- # https://spack.readthedocs.io/en/latest/binary_caches.html#spack-build-cache-for-github-actions
21name : Spack Builds (Ubuntu x86_64 Buildcache)
32
43on : [pull_request]
29283029 with :
3130 version : latest
32- github_token : ${{ secrets.GITHUB_TOKEN }}
3331
3432 # Use skopeo to check for image for convenience
3533 - name : Check for existing base images
4442 --creds "${{ env.USERNAME }}:${{ secrets.GITHUB_TOKEN }}" \
4543 > /dev/null && echo "Image already exists. Please bump version." && exit 0
4644 echo "IMAGE_EXISTS=false" >> $GITHUB_ENV
47- with :
48- github_token : ${{ secrets.GITHUB_TOKEN }}
4945
5046 # Need to build custom base image with gfortran
5147 - name : Create Dockerfile heredoc
6763 libstdc++6 \
6864 && rm -rf /var/lib/apt/lists/*
6965 EOF
70- with :
71- github_token : ${{ secrets.GITHUB_TOKEN }}
7266
7367 # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
7468 - name : Log in to the Container registry
7771 registry : ${{ env.REGISTRY }}
7872 username : ${{ env.USERNAME }}
7973 password : ${{ secrets.GITHUB_TOKEN }}
80- github_token : ${{ secrets.GITHUB_TOKEN }}
8174
8275 - name : Extract metadata (tags, labels) for Docker
8376 if : ${{ env.IMAGE_EXISTS == 'false' }}
8679 with :
8780 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
8881 labels : org.opencontainers.image.version=${{ env.BASE_VERSION }}
89- github_token : ${{ secrets.GITHUB_TOKEN }}
9082
9183 - name : Build and push Docker base image
9284 if : ${{ env.IMAGE_EXISTS == 'false' }}
9688 push : true
9789 tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }}
9890 labels : ${{ steps.meta.outputs.labels }}
99- github_token : ${{ secrets.GITHUB_TOKEN }}
10091
10192 hiop_spack_builds :
10293 needs : base_image_build
@@ -127,17 +118,12 @@ jobs:
127118 # Once we move submodule deps into spack, we can do some more builds
128119 # Also need to change build script to use spack from base image
129120 submodules : true
130- github_token : ${{ secrets.GITHUB_TOKEN }}
131121
132122 - name : Clone Spack
133123 run : git clone https://github.com/spack/spack.git
134- with :
135- github_token : ${{ secrets.GITHUB_TOKEN }}
136124
137125 - name : Setup Spack
138126 run : echo "$PWD/spack/bin" >> "$GITHUB_PATH"
139- with :
140- github_token : ${{ secrets.GITHUB_TOKEN }}
141127
142128 - name : Create heredoc spack.yaml
143129 run : |
@@ -172,45 +158,29 @@ jobs:
172158 # Building OpenSSL was causing errors
173159 require: "~openssl"
174160 EOF
175- with :
176- github_token : ${{ secrets.GITHUB_TOKEN }}
177161
178162 - name : Configure GHCR mirror
179163 run : spack -e . mirror set --oci-username ${{ env.USERNAME }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
180- with :
181- github_token : ${{ secrets.GITHUB_TOKEN }}
182164
183165 - name : Trust keys
184166 run : spack -e . buildcache keys --install --trust
185- with :
186- github_token : ${{ secrets.GITHUB_TOKEN }}
187167
188168 - name : Find external packages
189169 run : spack -e . external find --all --exclude python --exclude curl --exclude openssl
190- with :
191- github_token : ${{ secrets.GITHUB_TOKEN }}
192170
193171 - name : Spack develop HiOp
194172 run : spack -e . develop --path=$(pwd) hiop@git."${{ github.head_ref || github.ref_name }}"=develop
195- with :
196- github_token : ${{ secrets.GITHUB_TOKEN }}
197173
198174 - name : Concretize
199175 run : spack -e . concretize --fresh
200- with :
201- github_token : ${{ secrets.GITHUB_TOKEN }}
202176
203177 - name : Install Dependencies
204178 run : spack -e . install --no-check-signature --fail-fast --show-log-on-error --verbose --only dependencies
205- with :
206- github_token : ${{ secrets.GITHUB_TOKEN }}
207179
208180 - name : Install HiOp
209181 run : |
210182 ls -al
211183 spack -d -e . install --keep-stage --verbose --show-log-on-error --only package --no-cache
212- with :
213- github_token : ${{ secrets.GITHUB_TOKEN }}
214184
215185 - name : Test Build
216186 run : |
@@ -220,12 +190,24 @@ jobs:
220190 source env.txt || true
221191 cd $(spack -e . location --build-dir hiop@develop)
222192 ctest -VV
223- with :
224- github_token : ${{ secrets.GITHUB_TOKEN }}
225193
226194 - name : Push binaries to buildcache
227- run : |
228- spack -e . buildcache push --force --base-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }} --unsigned --update-index local-buildcache
229195 if : ${{ !cancelled() }}
230- with :
231- github_token : ${{ secrets.GITHUB_TOKEN }}
196+ env :
197+ # What Spack’s example expects
198+ GITHUB_USER : ${{ env.USERNAME }} # e.g. hiop-bot
199+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # packages: write perms
200+ run : |
201+ # Ensure the mirror uses these env var names for auth (idempotent)
202+ spack -e . mirror set \
203+ --oci-username-variable GITHUB_USER \
204+ --oci-password-variable GITHUB_TOKEN \
205+ local-buildcache
206+
207+ # Push (NO username/password flags here!)
208+ spack -e . buildcache push \
209+ --force \
210+ --base-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_VERSION }} \
211+ --unsigned \
212+ --update-index \
213+ local-buildcache
0 commit comments