ci: improve buildcache workflow

- rename mirror to ghcr-buildcache
- find system compiler before building gcc
- separate update-index job to avoid race condition
- always attempt push even on partial failure
This commit is contained in:
Dennis Klein
2025-11-30 15:51:13 +01:00
parent 1392a31250
commit 399170879c
2 changed files with 52 additions and 7 deletions

View File

@@ -32,16 +32,61 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/setup-deps - name: Setup spack
uses: spack/setup-spack@v2
with: with:
gcc: ${{ matrix.gcc }} ref: v1.1.0
fresh: true color: true
buildcache: true
- name: Login to OCI registry - name: Create environment and login to OCI registry
shell: spack-bash {0} shell: spack-bash {0}
run: spack -e fairmq mirror set --push --oci-username ${{ github.actor }} --oci-password-variable GITHUB_TOKEN local-buildcache run: |
spack env create fairmq test/ci/spack.yaml
spack -e fairmq mirror set --oci-username ${{ github.actor }} --oci-password-variable GITHUB_TOKEN ghcr-buildcache
- name: Find system compiler
shell: spack-bash {0}
run: spack compiler find
- name: Install GCC
shell: spack-bash {0}
run: |
spack install gcc@${{ matrix.gcc }}
spack compiler find $(spack location -i gcc@${{ matrix.gcc }})
- name: Install dependencies
shell: spack-bash {0}
run: |
spack -e fairmq add gcc@${{ matrix.gcc }}
spack -e fairmq config add "packages:all:require:'%gcc@${{ matrix.gcc }}'"
spack -e fairmq install --fail-fast --fresh
- name: Push to buildcache - name: Push to buildcache
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
shell: spack-bash {0} shell: spack-bash {0}
run: spack buildcache push --unsigned --update-index local-buildcache run: spack -e fairmq buildcache push --unsigned ghcr-buildcache
update-index:
if: github.repository == 'FairRootGroup/FairMQ' && !cancelled()
needs: build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup spack
uses: spack/setup-spack@v2
with:
ref: v1.1.0
color: true
- name: Update buildcache index
shell: spack-bash {0}
run: |
spack env create fairmq test/ci/spack.yaml
spack -e fairmq mirror set --oci-username ${{ github.actor }} --oci-password-variable GITHUB_TOKEN ghcr-buildcache
spack -e fairmq buildcache update-index ghcr-buildcache

View File

@@ -8,6 +8,6 @@ spack:
padded_length: 128 padded_length: 128
mirrors: mirrors:
local-buildcache: ghcr-buildcache:
url: oci://ghcr.io/fairrootgroup/fairmq-spack-buildcache url: oci://ghcr.io/fairrootgroup/fairmq-spack-buildcache
signed: false signed: false