Skip to content

Add Spack buildcache to CPU Ubuntu builds #184

Add Spack buildcache to CPU Ubuntu builds

Add Spack buildcache to CPU Ubuntu builds #184

# https://spack.readthedocs.io/en/latest/binary_caches.html#spack-build-cache-for-github-actions
name: Spack Ubunutu x86_64 Buildcache
env:
SPACK_COLOR: always
# Until we remove the need to clone submodules to build, this should on be in PRs
on: [pull_request]
jobs:
exago_spack_builds:
# 20.04 is a version shared by E4S cache and Spack binaries for x86_64
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
# Minimal Build(s)
# Need S3 mirror to have these builds speedup
spack_spec:
# See #39 - ~python~mpi causes issues
# - exago@develop~mpi~ipopt~hiop~python~raja
# See #44 - +mpi~python should fail if no python in system,
# but the runner happens to have one...
- exago@1.6.0+mpi~ipopt+hiop~python~raja ^openmpi
# See #18 - +hiop~mpi causes issues
# - exago@develop~mpi~ipopt+hiop~python+raja
# See #16 - +python~mpi causes issues
# - exago@develop~mpi~ipopt+hiop+python~raja
- exago@1.6.0+mpi~ipopt+hiop+python~raja ^openmpi
# See #40 - +hiop+raja~ipopt ^hiop~sparse is useful for edge cases
- exago@1.6.0+mpi~ipopt+hiop~python+raja ^openmpi ^hiop+raja~sparse
name: Build ExaGO with Spack
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Once we move submodule deps into spack, we can do some more builds
# Also need to change build script to use spack from base image
submodules: true
- name: Setup Spack
run: echo "$PWD/tpl/spack/bin" >> "$GITHUB_PATH"
- name: Create heredoc spack.yaml
run: |
cat << EOF > spack.yaml
spack:
specs:
- ${{ matrix.spack_spec }}
concretizer:
unify: true
reuse: true
config:
install_tree:
root: /opt/spack
padded_length: 128
packages:
all:
require: target=x86_64_v2
mirrors:
local-buildcache: oci://ghcr.io/pnnl/ExaGO
spack: https://binaries.spack.io/develop
- name: Configure GHCR mirror
run: spack -e . mirror set --oci-username exago-bot --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
- name: Trust keys
run: spack -e . buildcache keys --install --trust
- name: Find external packages
run: spack -e . external find --all --exclude python
- name: Concretize
run: spack -e . concretize
- name: Install
run: spack -e . install --no-check-signature
- name: Push to buildcache
run: |
spack -e . buildcache push --base-image ubuntu:22.04 --unsigned --update-index local-buildcache
if: ${{ !cancelled() }}