Skip to content

numpex/spack-buildcache-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spack Build-Cache Action

GitHub Release GitHub License Static Badge

A GitHub Actions composite action to:

  1. Install your project (and dependencies) via Spack
  2. Push the resulting binary buildcache to a remote OCI registry mirror

Features

  • Checks out your repository (including submodules)
  • Sets up Spack via spack/setup-spack
  • Clones your custom Spack package recipes repo
  • Adds it as a Spack repository
  • Installs the specified Spack environment variant
  • Pushes the buildcache to a specified OCI mirror

Usage

Add this step to your workflow:

jobs:
  build-cache:
    runs-on: ubuntu-24.04
    permissions:
      packages: write

    steps:
      - name: Build & Push Spack Buildcache
        uses: numpex/spack-buildcache-action@v1
        with:
          env-variant: default
          mirror: my-org/my-spack-mirror
          # Optional inputs shown with their defaults:
          # repo-packages: numpex/spack.numpex
          # repo-packages-path: spack.numpex
          # spack-path: _spack
          # base-image: ubuntu:24.04

Inputs

Input Description Required Default
env-variant Spack environment variant to install (e.g. default, omp, etc.)
mirror Name of the OCI mirror (e.g. my-org/my-spack-mirror)
repo-packages GitHub repo with your Spack package recipes numpex/spack.numpex
repo-packages-path Local directory to clone the Spack packages repo spack.numpex
spack-path Local install path for the Spack checkout _spack
base-image Base Docker image passed to spack buildcache push --base-image ubuntu:24.04

Example Workflow

name: CI

on:
  push:
    tags:
      - 'v*'

jobs:
  build-cache:
    runs-on: ubuntu-24.04
    permissions:
      packages: write

    steps:
      - name: Build & publish Spack cache
        uses: numpex/spack-buildcache-action@v1
        with:
          env-variant: default
          mirror: numpex/spack-buildcache

Test Workflow Example

Here’s a sample workflow you can use within your Spack Build-Cache Action repository to test the action locally:

name: Test Spack Build-Cache Action

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  smoke:
    runs-on: ubuntu-24.04
    permissions:
      contents: read
      packages: write

    steps:
      # 1) Check out this action’s code
      - name: Checkout action
        uses: actions/checkout@v4

      # 2) Run our composite action locally
      - name: Run Spack Build-Cache
        uses: ./
        with:
          env-variant: default
          repo-packages: numpex/spack.numpex
          repo-packages-path: spack.numpex
          mirror: numpex-buildcache

      # 3) Verify installed specs
      - name: List installed specs
        run: |
          . _spack/share/spack/setup-env.sh
          spack find -lv

License

BSD-3 License

About

Spack Build-Cache Action

Resources

License

Stars

Watchers

Forks

Packages

No packages published