-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci.yml: Added json validation job and checking validity of spack-{pac…
…kages,config}
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- backport/*.* | ||
paths: | ||
- config/** | ||
- spack.yaml | ||
jobs: | ||
validate-json: | ||
name: Validate JSON | ||
uses: access-nri/actions/.github/workflows/validate-json.yml@main | ||
with: | ||
src: "config" | ||
|
||
check-json: | ||
name: Check JSON Fields | ||
needs: | ||
- validate-json | ||
runs-on: ubuntu-latest | ||
outputs: | ||
spack-packages-version: ${{ steps.versions.outputs.packages }} | ||
spack-config-version: ${{ steps.versions.outputs.config }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# The next steps checkout the spack-{packages,config} repos to confirm that the versions in | ||
# versions.json exist in the repositories. | ||
- name: Setup | ||
id: versions | ||
run: | | ||
echo "packages=$(jq --compact-output --raw-output '."spack-packages"' ./config/versions.json)" >> $GITHUB_OUTPUT | ||
echo "config=$(jq --compact-output --raw-output '."spack-config"' ./config/versions.json)" >> $GITHUB_OUTPUT | ||
- name: Spack Packages | ||
id: spack-packages | ||
continue-on-error: true | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: access-nri/spack-packages | ||
ref: ${{ steps.versions.outputs.packages }} | ||
path: packages | ||
|
||
- name: Spack Config | ||
id: spack-config | ||
continue-on-error: true | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: access-nri/spack-config | ||
ref: ${{ steps.versions.outputs.config }} | ||
path: config | ||
|
||
- name: Failure Notifier | ||
if: contains(steps.*.outcome, 'failure') | ||
run: | | ||
if [[ "${{ steps.spack-packages.outcome }}" == "failure" ]]; then | ||
echo "::error::spack-packages at the specified ref (${{ steps.versions.outputs.packages }}) doesn't exist." | ||
fi | ||
if [[ "${{ steps.spack-config.outcome }}" == "failure" ]]; then | ||
echo "::error::spack-config at the specified ref (${{ steps.versions.outputs.config }}) doesn't exist." | ||
fi | ||
exit 1 |