Skip to content

Commit 4f5994d

Browse files
committed
Separate the checks so that we get a more complete set of results
1 parent b49b1f9 commit 4f5994d

File tree

1 file changed

+46
-30
lines changed

1 file changed

+46
-30
lines changed

.github/workflows/test-eb-hooks.yml

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,56 @@
11
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
2-
name: Check whether eb_hooks.py script is up-to-date
2+
name: Run checks on EasyBuild hooks script
33
on:
44
push:
55
pull_request:
66
workflow_dispatch:
77
permissions:
88
contents: read # to fetch code (actions/checkout)
99
jobs:
10-
check_eb_hooks:
10+
check_eb_hooks_uptodate:
11+
runs-on: ubuntu-24.04
12+
strategy:
13+
matrix:
14+
EESSI_VERSION:
15+
- '2023.06'
16+
- '2025.06'
17+
18+
steps:
19+
- name: Check out software-layer repository
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
21+
22+
- name: Mount EESSI CernVM-FS repository
23+
uses: eessi/github-action-eessi@v3
24+
with:
25+
eessi_stack_version: ${{matrix.EESSI_VERSION}}
26+
use_eessi_module: true
27+
28+
- name: Check whether eb_hooks.py script is up-to-date
29+
if: ${{ github.event_name == 'pull_request' }}
30+
run: |
31+
FILE="eb_hooks.py"
32+
TEMP_FILE="$(mktemp)"
33+
34+
# Fetch base branch
35+
git fetch origin ${{ github.base_ref }}
36+
37+
# Check if the hooks has changed in the PR
38+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^$FILE$"; then
39+
echo "Hooks changed in PR. Using PR version."
40+
cp "$FILE" "$TEMP_FILE"
41+
else
42+
echo "File not changed in PR. Using default branch version."
43+
git show origin/${{ github.base_ref }}:$FILE > "$TEMP_FILE"
44+
fi
45+
46+
# replace <EESSI_VERSION> placeholder (as is also done in install_scripts.sh)
47+
sed -i "s/<EESSI_VERSION>/${{matrix.EESSI_VERSION}}/g" "${TEMP_FILE}"
48+
49+
# Compare the hooks to what is shipped in the repository
50+
module load EESSI-extend
51+
diff "$TEMP_FILE" "$EASYBUILD_HOOKS"
52+
53+
check_eb_hooks_functionality:
1154
runs-on: ubuntu-24.04
1255
strategy:
1356
matrix:
@@ -26,16 +69,14 @@ jobs:
2669
steps:
2770
- name: Check out software-layer repository
2871
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29-
with:
30-
fetch-depth: 0 # Fetch all history for all branches and tags
3172

3273
- name: Mount EESSI CernVM-FS repository
3374
uses: eessi/github-action-eessi@v3
3475
with:
3576
eessi_stack_version: ${{matrix.EESSI_VERSION}}
3677
use_eessi_module: true
3778

38-
- name: Test that toolchain verification check works
79+
- name: Test that hook toolchain verification check works
3980
if: ${{ github.event_name == 'pull_request' }}
4081
run: |
4182
# Set up some environment variables
@@ -53,28 +94,3 @@ jobs:
5394
5495
# Check the override works
5596
EESSI_OVERRIDE_TOOLCHAIN_CHECK=1 eb --hooks=$PWD/eb_hooks.py "$INCOMPATIBLE_EASYCONFIG" --stop fetch
56-
57-
- name: Check that EasyBuild hook is up to date
58-
if: ${{ github.event_name == 'pull_request' }}
59-
run: |
60-
FILE="eb_hooks.py"
61-
TEMP_FILE="$(mktemp)"
62-
63-
# Fetch base branch
64-
git fetch origin ${{ github.base_ref }}
65-
66-
# Check if the hooks has changed in the PR
67-
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^$FILE$"; then
68-
echo "Hooks changed in PR. Using PR version."
69-
cp "$FILE" "$TEMP_FILE"
70-
else
71-
echo "File not changed in PR. Using default branch version."
72-
git show origin/${{ github.base_ref }}:$FILE > "$TEMP_FILE"
73-
fi
74-
75-
# replace <EESSI_VERSION> placeholder (as is also done in install_scripts.sh)
76-
sed -i "s/<EESSI_VERSION>/${{matrix.EESSI_VERSION}}/g" "${TEMP_FILE}"
77-
78-
# Compare the hooks to what is shipped in the repository
79-
module load EESSI-extend
80-
diff "$TEMP_FILE" "$EASYBUILD_HOOKS"

0 commit comments

Comments
 (0)