Skip to content

Commit 91ecf62

Browse files
authored
ci(spack): validate simphony Spack install in pull requests (#339)
Add a dedicated Docker stage that installs `simphony` via Spack, and validate that install path in pull request CI. ## What changed - add a `spack-base` / `spack-no-env` flow in `Dockerfile` - install Spack in the image and configure shell startup to source `setup-env.sh` - use the latest builtin Spack repo state plus `BNLNPPS/spack-packages` - install `simphony` through Spack in two steps: - `spack install --only=dependencies simphony ...` - `spack install --reuse simphony` - add `.github/workflows/build-pull-request-spack.yaml` - run a PR-only CI job that builds the `spack-no-env` stage - smoke-test the result by verifying that `simphony` is installed and its Spack prefix exists ## Why This gives us a focused CI signal that the current `simphony` package recipe remains installable via Spack, without coupling that check to the existing development-image workflows. ## Notes - the Spack Docker stage is intended for package validation, not for development - the CI job uses Dockerfile defaults rather than maintaining a separate version matrix - the Spack repo state is intentionally not pinned so CI can catch packaging regressions against current Spack metadata
1 parent a7d625d commit 91ecf62

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build Pull Request Spack
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
spack-install:
17+
runs-on: ubuntu-latest
18+
env:
19+
IMAGE_TAG: simphony-spack-ci:pr-${{ github.event.pull_request.number }}
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Define environment variables
26+
run: |
27+
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
28+
echo "SPACK_BUILDCACHE_MIRROR=oci://ghcr.io/${REPO_OWNER}/simphony-spack-buildcache" >> "$GITHUB_ENV"
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Build Spack install image and run smoke test
34+
uses: docker/build-push-action@v6
35+
with:
36+
context: .
37+
pull: true
38+
target: spack-no-env
39+
build-args: |
40+
SPACK_BUILDCACHE_MIRROR=${{ env.SPACK_BUILDCACHE_MIRROR }}

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,30 @@ ENV NVIDIA_DRIVER_CAPABILITIES=graphics,compute,utility
136136
WORKDIR ${OPTICKS_HOME}
137137

138138
SHELL ["/bin/bash", "-l", "-c"]
139+
140+
141+
FROM spack-base AS spack-no-env
142+
143+
WORKDIR ${OPTICKS_HOME}
144+
145+
# Intentionally track the latest Spack repo state in CI to catch packaging regressions.
146+
RUN spack repo update -b develop builtin
147+
RUN spack repo add https://github.com/BNLNPPS/spack-packages
148+
RUN spack mirror add --unsigned simphony-buildcache "${SPACK_BUILDCACHE_MIRROR}"
149+
RUN spack external find --not-buildable --path /usr/local/cuda cuda
150+
# Prefer dependency binaries when they exist, but let PR validation fall back to
151+
# source builds if the mirror lags behind the latest Spack package metadata.
152+
RUN spack install --only=dependencies --reuse --use-buildcache auto simphony ^geant4@${GEANT4_VERSION} ^optix-dev@${OPTIX_VERSION}
153+
RUN spack install --reuse --use-buildcache package:never,dependencies:auto simphony ^geant4@${GEANT4_VERSION} ^optix-dev@${OPTIX_VERSION}
154+
RUN spack clean -a && rm -rf /root/.cache
155+
# Once simphony is installed it can be loaded in the user environment
156+
# $ spack load simphony
157+
# $ spack load --sh simphony >> /etc/profile.d/z10_load_simphony_from_spack.sh
158+
RUN set -euo pipefail \
159+
&& spack find --format "{name}{@version} {/hash}" simphony \
160+
&& prefix="$(spack location -i simphony)" \
161+
&& echo "Installed prefix: $prefix" \
162+
&& test -d "$prefix" \
163+
&& (test -f "$prefix/.spack/spec.json" || test -f "$prefix/.spack/spec.yaml")
164+
165+
FROM develop AS default

0 commit comments

Comments
 (0)