Skip to content

Added test logic

Added test logic #6

Workflow file for this run

name: script test
on:
pull_request:
paths:
- 'spack.yaml'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Projection Version Matches
# this step checks that the versions of the packages themselves match with the
# names of the modules. For example, mom5@git.2023.12.12 matches with the
# modulefile mom5/2023.12.12 (specifically, the version strings match)
run: |
FAILED='false'
DEPS=$(yq ".spack.modules.default.tcl.include | join(\" \")" spack.yaml)
# for each of the packages (access-om2, mom5, cice5...)
for DEP in $DEPS; do
DEP_VER='null'
if [[ "$DEP" == "access-om2" ]]; then
DEP_VER=$(yq ".spack.specs[]" spack.yaml | cut -c16-)
else
DEP_VER=$(yq ".spack.packages.\"$dep\".require" spack.yaml | cut -c6-)
echo "other: $DEP_VER"
fi
echo "out: $DEP_VER"
MODULE_VER=$(yq ".spack.modules.default.tcl.projections.\"$DEP\"" spack.yaml | cut -c8-)
if [[ "$DEP_VER" != "$MODULE_VER" ]]; then
echo "::error::Version of dependency and projection do not match ($DEP_VER != $MODULE_VER)"
FAILED='true'
fi
done
if [[ "$FAILED" == "true" ]]; then
exit 1
fi