From 89f9f09c82d8a41a744c8001bdef5ae6e57d579a Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Sun, 30 Nov 2025 20:34:20 +0100 Subject: [PATCH] ci: deduplicate buildcache workflow using setup-deps action --- .github/actions/setup-deps/action.yml | 6 +++- .github/workflows/buildcache.yml | 42 ++++++--------------------- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/.github/actions/setup-deps/action.yml b/.github/actions/setup-deps/action.yml index b81ccb77..71b1cf73 100644 --- a/.github/actions/setup-deps/action.yml +++ b/.github/actions/setup-deps/action.yml @@ -22,10 +22,14 @@ runs: color: true buildcache: true + - name: Find system compiler + shell: spack-bash {0} + run: spack compiler find + - name: Install GCC shell: spack-bash {0} run: | - spack install gcc@${{ inputs.gcc }} + spack install ${{ inputs.fresh == 'true' && '--fresh' || '' }} gcc@${{ inputs.gcc }} target=x86_64_v3 spack compiler find $(spack location -i gcc@${{ inputs.gcc }}) - name: Install dependencies diff --git a/.github/workflows/buildcache.yml b/.github/workflows/buildcache.yml index 4a9f68e2..6c34b936 100644 --- a/.github/workflows/buildcache.yml +++ b/.github/workflows/buildcache.yml @@ -29,47 +29,23 @@ jobs: - gcc: '15' env: 'boost187' - env: - GITHUB_USER: ${{ github.actor }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - uses: actions/checkout@v4 - - name: Setup spack - uses: spack/setup-spack@v2 + - uses: ./.github/actions/setup-deps with: - ref: v1.1.0 - color: true - buildcache: true - - - name: Create environment and login to OCI registry - shell: spack-bash {0} - run: | - spack env create fairmq test/ci/spack-${{ matrix.env }}.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 --fresh 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 + gcc: ${{ matrix.gcc }} + env: ${{ matrix.env }} + fresh: 'true' - name: Push to buildcache if: ${{ !cancelled() }} shell: spack-bash {0} - run: spack -e fairmq buildcache push --unsigned ghcr-buildcache + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + spack -e fairmq mirror set --oci-username ${{ github.actor }} --oci-password-variable GITHUB_TOKEN ghcr-buildcache + spack -e fairmq buildcache push --unsigned ghcr-buildcache update-index: if: github.repository == 'FairRootGroup/FairMQ' && !cancelled()