Skip to content

Commit 44467f5

Browse files
authored
Merge pull request #1458 from TopRichard/Modify-test-software.eessi.io-workflow
Skip check for missing installations when no easystack file is changed
2 parents 7dc0d7d + 6fc8217 commit 44467f5

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/test-software.eessi.io.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,52 @@ env:
3333
# and then allow for special cases for specific architectures
3434
aarch64/a64fx: []
3535
jobs:
36+
# Checks whether this PR modifies any easystack files and, if so,
37+
# determines which EESSI versions are affected.
38+
# It then stores those versions as a space-separated list in an
39+
# environment variable.
40+
# Finally, it writes that value to GITHUB_OUTPUT using the correct
41+
# heredoc format.
42+
check_EESSI_version_changed_files:
43+
runs-on: ubuntu-24.04
44+
outputs:
45+
EESSI_VERSIONS: ${{ steps.detect.outputs.EESSI_VERSIONS }}
46+
steps:
47+
- name: Check out software-layer repository
48+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
49+
with:
50+
fetch-depth: 0 # Fetch all history for all branches and tags
51+
52+
- name: Detect EESSI version in modified easystack files
53+
id: detect
54+
run: |
55+
# Fetch base branch explicitly to ensure it's available
56+
git fetch origin ${{ github.base_ref }}
57+
58+
changed_files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
59+
echo "Files changed: $changed_files"
60+
61+
# Default to not checking missing software for any version
62+
EESSI_VERSIONS=""
63+
64+
# Check for specific versions in the changed easystack files
65+
# The regex pattern matches a prefix, but only returns the part after \K, so that we get only the version
66+
# The sort ensures predictable ordering, and with -u only keeps unique items (neither are probably essential, but both are nice)
67+
# Finally, since the grep returns multiple lines if there are multiple versions that were touched,
68+
# the tr replaces newlines with space, to make this space-separated.
69+
EESSI_VERSIONS=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \
70+
| grep -oP 'easystacks/software\.eessi\.io/\K[0-9]+\.[0-9]+' \
71+
| sort -u \
72+
| tr '\n' ' ')
73+
echo "PR easystack changes related to EESSI VERSION: $EESSI_VERSIONS"
74+
75+
# Use GITHUB_OUTPUT heredoc correctly
76+
echo "EESSI_VERSIONS<<EOF" >> "$GITHUB_OUTPUT"
77+
echo "$EESSI_VERSIONS" >> "$GITHUB_OUTPUT"
78+
echo "EOF" >> "$GITHUB_OUTPUT"
79+
3680
check_missing:
81+
needs: check_EESSI_version_changed_files
3782
strategy:
3883
fail-fast: false
3984
matrix:
@@ -153,6 +198,7 @@ jobs:
153198
cvmfs_repositories: software.eessi.io
154199

155200
- name: Check for missing installlations
201+
if: contains(needs.check_EESSI_version_changed_files.outputs.EESSI_VERSIONS, matrix.EESSI_VERSION)
156202
run: |
157203
export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}}
158204
source /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/bash

0 commit comments

Comments
 (0)