From 06ed17bd80bc70941f7be4e202f03581069b7655 Mon Sep 17 00:00:00 2001 From: Tommy Gatti Date: Thu, 23 May 2024 11:50:18 +1000 Subject: [PATCH] ci.yml: Updated splitting logic, added better error logs, added TODO (#83) --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8897818..bea0119 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,6 +128,7 @@ jobs: # this step checks that the versions of the packages themselves match with the # names of the modules. For example, access-om3@git.2023.12.12 matches with the # modulefile access-om3/2023.12.12 (specifically, the version strings match) + # TODO: Move this into the `scripts` directory - it's getting unweildly. run: | FAILED='false' DEPS=$(yq ".spack.modules.default.tcl.include | join(\" \")" spack.yaml) @@ -138,13 +139,15 @@ jobs: if [[ "$DEP" == "${{ needs.defaults.outputs.root-sbd }}" ]]; then DEP_VER=$(yq '.spack.specs[0] | split("@git.") | .[1]' spack.yaml) else - DEP_VER=$(yq ".spack.packages.\"$DEP\".require[0] | split(\"@git.\") | .[1]" spack.yaml) + # Capture the section after '@git.' or '@' (if it's not a git-attributed version) for a given dependency. + # Ex. '@git.2024.02.11' -> '2024.02.11', '@access-esm1.5' -> 'access-esm1.5' + DEP_VER=$(yq ".spack.packages.\"$DEP\".require[0] | match(\"^@(?:git.)?(.*)\").captures[0].string" spack.yaml) fi MODULE_VER=$(yq ".spack.modules.default.tcl.projections.\"$DEP\" | split(\"/\") | .[1]" spack.yaml) if [[ "$DEP_VER" != "$MODULE_VER" ]]; then - echo "::error::Version of dependency and projection do not match ($DEP_VER != $MODULE_VER)" + echo "::error::$DEP: Version of dependency and projection do not match ($DEP_VER != $MODULE_VER)" FAILED='true' fi done