Skip to content
Merged
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
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
DEFAULT_SPACK_REF: 'releases/v1.0'
DEFAULT_SPACK_CONFIG_REF: 'main'
DEFAULT_SPACK_PACKAGES_REF: ${{ github.event.pull_request.head.sha }}
PACKAGES_ROOT_DIR: spack_repo/access/nri/packages
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
spack-packages-ref: ${{ steps.set-refs.outputs.spack-packages-ref }}
Expand All @@ -45,10 +46,10 @@ jobs:
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
with:
# We only care about the directory names under packages/ - since they are also the package names
# We only care about the directory names under the env.PACKAGES_ROOT_DIR - since they are also the package names
# and we want to find changes to the package.py files in those directories
dir_names: true
path: ./spack_repo/access/nri/packages
path: ./${{ env.PACKAGES_ROOT_DIR }}
files: '*/package.py'

- name: Dispatch - Get packages
Expand All @@ -57,7 +58,7 @@ jobs:
# Either get all packages defined (all subfolders under packages/) or use the input
run: |
if [[ "${{ inputs.packages-to-test }}" == "ALL" ]]; then
pkgs=$(find packages/ -mindepth 1 -maxdepth 1 -type d -printf '%P ')
pkgs=$(find ${{ env.PACKAGES_ROOT_DIR }}/ -mindepth 1 -maxdepth 1 -type d -printf '%P ')
else
pkgs="${{ inputs.packages-to-test }}"
fi
Expand All @@ -66,7 +67,7 @@ jobs:
# Validate that all packages exist
error=false
for pkg in $pkgs; do
if [ ! -f "packages/$pkg/package.py" ]; then
if [ ! -f "${{ env.PACKAGES_ROOT_DIR }}/$pkg/package.py" ]; then
echo "::error::packages/$pkg/package.py does not exist. Check spelling or if the package is defined."
error=true
fi
Expand All @@ -84,17 +85,16 @@ jobs:
# Get file paths to manifests for each package, and a template, then finally
# Convert into a JSON array for the matrix, one of the form:
# [
# {"filepath": ".github/build-ci/manifests/mom5/intel.spack.yaml.j2", "template_value": "mom5"},
# {"filepath": ".github/build-ci/manifests/mom5/amd.spack.yaml.j2", "template_value": "mom5"},
# {"filepath": ".github/build-ci/manifests/cice5/spack.yaml.j2", "template_value": "cice5"},
# {"template_value": "mom5", "filepath": ".github/build-ci/manifests/mom5/intel.spack.yaml.j2"},
# {"template_value": "mom5", "filepath": ".github/build-ci/manifests/mom5/amd.spack.yaml.j2"},
# {"template_value": "cice5", "filepath": ".github/build-ci/manifests/cice5/spack.yaml.j2"},
# ...
# ]
run: |
pkgs="${{ steps.set-matrix-pr.outputs.all_changed_files || steps.set-matrix-dispatch.outputs.pkgs }}"

for pkg in $pkgs; do
# We want each manifest to have an associated injection of {{ package }} to $pkg
# From PR 346:
# Replace underscores with hyphens for the template value, as spack converts directory underscores to package name hyphens
template_value="${pkg//_/-}"

Expand All @@ -109,7 +109,7 @@ jobs:
fi

for manifest_path in $manifest_paths; do
json_entry=$(printf '{"filepath": "%s", "template_value": "%s"}' "$manifest_path" "$template_value")
json_entry=$(printf '{"template_value": "%s", "filepath": "%s"}' "$template_value" "$manifest_path")
json_entries+="${json_entry},"
done
unset manifest_paths
Expand Down