Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/build-ci/data/standard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"gcc_compiler_ver": "@13.2.0",
"intel_compiler_ver": "@2021.10.0",
"oneapi_compiler_ver": "@2025.2.0",
"target": "x86_64"
}
14 changes: 14 additions & 0 deletions .github/build-ci/manifests/gcc-access-test-component.spack.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
spack:
specs:
- access-test-component
packages:
gcc:
require:
- '{{ gcc_compiler_ver }}'
all:
require:
- '%access_gcc'
- 'target={{ target }}'
concretizer:
unify: false
view: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
spack:
specs:
- access-test-component
packages:
python:
require:
- '@3.11.14'
intel-oneapi-compilers-classic:
require:
- '{{ intel_compiler_ver }}'
all:
require:
- '%access_intel'
- 'target={{ target }}'
concretizer:
unify: false
view: false
146 changes: 146 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: CI
on:
pull_request:
paths:
# We only want to run CI on spack versions that don't utilise symlinks (AKA pre-v1.1),
# in order to keep the CI simple. This means that the below pattern is essentially
# everthing in the v* directories, excluding the symlinked v0.* spack versions.
- 'v**'
- '!v0.**'
workflow_dispatch:
inputs:
spack-config-directories-to-test:
description: 'Space-separated list of version-based spack-config directories to test against'
required: true
type: string
default: v1.1
spack-config-ref:
description: 'spack-config ref to use'
required: true
type: string
spack-ref:
description: 'spack ref to use'
required: true
type: string
run-self-hosted:
description: 'Use self-hosted runners for the test'
required: true
default: true
type: boolean
jobs:
setup-ci:
name: Setup CI
runs-on: ubuntu-latest
env:
# Note, this needs to be updated in line with refs in the CI job below
BUILD_CI_WORKFLOW_VERSION: v3
# Which repository we get the manifest-to-test from
SPACK_MANIFEST_REPOSITORY: ACCESS-NRI/access-spack-packages
outputs:
spack-manifest-repository: ${{ env.SPACK_MANIFEST_REPOSITORY }}
# Matrices used in CI job
manifest-matrix: ${{ steps.setup-manifests.outputs.matrix }}
config-matrix: ${{ steps.setup-config.outputs.matrix }}
# Global defaults for CI job
spack-config-ref: ${{ inputs.spack-config-ref || github.event.pull_request.head.sha }}
spack-ref: ${{ inputs.spack-ref || steps.defaults.outputs.spack-ref }}
steps:
- name: Checkout spack-config
uses: actions/checkout@v6

- name: PR - Get dirs changed
id: set-matrix-pr
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
dir_names: true # we want a list of spack configuration directories (eg. v1.1, v1.2)
dir_names_max_depth: 1 # and don't care about subdirectories
dir_names_exclude_current_dir: true # or files changed in the root directory
# Below is an equivalent condition to on.pull_request.paths
files: |
v*/**
!v0.*/**

- name: Dispatch - Get config directory to test
id: set-matrix-dispatch
if: github.event_name == 'workflow_dispatch'
run: |
echo "dirs=${{ inputs.spack-config-directories-to-test }}" >> $GITHUB_OUTPUT

- name: Get Manifests from ${{ env.SPACK_MANIFEST_REPOSITORY }}
uses: actions/checkout@v6
with:
repository: ${{ env.SPACK_MANIFEST_REPOSITORY }}

- name: Setup Manifest Matrix
id: setup-manifests
# To simplify the matrix creation logic later on, we are splitting the matrices into a manifest file name one,
# and a configuration one - they will be applied in combination in the CI job.
run: |
manifests=$(find .github/build-ci/manifests -type f -printf '"%p",')
echo "$manifests"
echo "matrix=[${manifests%,}]" >> $GITHUB_OUTPUT

- name: Setup Spack Version Branch Matrix
id: setup-config
# Create a matrix of configuration directories (eg. v1.1)
run: |
json_entries=""

for config_dir in ${{ steps.set-matrix-pr.outputs.all_changed_files || steps.set-matrix-dispatch.outputs.dirs }}; do
# For directories of the form 'v1.1/blah', this will give `v1.1`
spack_branch_version=$(cut -d'/' -f1 <<< "$config_dir")

json_entry=$(printf '{"spack-version-branch": "%s"}' "$spack_branch_version")
json_entries+="${json_entry},"
done

echo "$json_entries"
echo "matrix=[${json_entries%,}]" >> $GITHUB_OUTPUT

- name: Checkout build-ci
uses: actions/checkout@v6
with:
repository: access-nri/build-ci
ref: ${{ env.BUILD_CI_WORKFLOW_VERSION }}

- name: Get default refs from build-ci workflow
id: defaults
# GitHub does not treat empty-string inputs as eligible for substitution with a default
# Since we are supporting both workflow_dispatch and pull_request triggers, the entrypoint inputs need to be filled in
# So we are getting the default values from the workflow file itself, and passing them back into the workflow
run: |
default_spack_ref=$(yq '.on.workflow_call.inputs."spack-ref".default' .github/workflows/ci.yml)

echo "Default refs from ${{ env.BUILD_CI_WORKFLOW_VERSION }}: spack-ref=$default_spack_ref"

echo "spack-ref=$default_spack_ref" >> $GITHUB_OUTPUT

ci:
name: CI
needs:
- setup-ci
strategy:
fail-fast: false
max-parallel: 5
matrix:
manifest: ${{ fromJson(needs.setup-ci.outputs.manifest-matrix) }}
config: ${{ fromJson(needs.setup-ci.outputs.config-matrix) }}
# Respectively of the form:
# [ .github/build-ci/manifests/some.spack.yaml, ...]
# And:
# [{
# spack-version-branch: v1.1
# }, ...]
uses: access-nri/build-ci/.github/workflows/ci.yml@v3
with:
spack-manifest-repository: ${{ needs.setup-ci.outputs.spack-manifest-repository }}
spack-manifest-path: ${{ matrix.manifest }}
spack-manifest-data-path: .github/build-ci/data/standard_definitions.json
spack-config-ref: ${{ needs.setup-ci.outputs.spack-config-ref }}
spack-ref: ${{ needs.setup-ci.outputs.spack-ref }}
container-image-version: :rocky-${{ matrix.config.spack-version-branch }}
# Workflow dispatch can switch depending on cluster/GitHub resourcing, otherwise run self-hosted
run-self-hosted: ${{ inputs.run-self-hosted || true }}
secrets:
spack-install-command-pat: ${{ secrets.SPACK_INSTALL_COMMAND_PAT }}