Skip to content

Commit bcc67fd

Browse files
authored
Merge branch 'main' into update_CI_for_202606
2 parents 06a55e2 + 50962eb commit bcc67fd

10 files changed

Lines changed: 357 additions & 136 deletions

File tree

.github/workflows/scripts/test_utils.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,58 @@ check_disallowed_env_prefix() {
4545
echo "✅ No disallowed environment variables with prefix '$prefix' found."
4646
fi
4747
}
48+
49+
init_eessi_environment() {
50+
# Helper function to initialize the EESSI environment, and optionally add
51+
# a path to the modulepath in which EESSI-extend has made local installs
52+
# Expected usage:
53+
# init_eessi_environment --eessi-version <version> [--installation-path <path>] \
54+
# [--accelerator-target <target>] [--cuda-cc <n>]
55+
local eessi_version=""
56+
local eessi_extend_installation_path=""
57+
local accelerator_target_override=""
58+
local cuda_cc=""
59+
60+
while [[ $# -gt 0 ]]; do
61+
case "$1" in
62+
--eessi-version)
63+
eessi_version="$2"
64+
shift 2
65+
;;
66+
--installation-path)
67+
eessi_extend_installation_path="$2"
68+
shift 2
69+
;;
70+
--accelerator-target)
71+
accelerator_target_override="$2"
72+
shift 2
73+
;;
74+
--cuda-cc)
75+
cuda_cc="$2"
76+
shift 2
77+
;;
78+
*)
79+
echo "ERROR: Unknown option '$1' passed to init_eessi_environment" >&2
80+
return 1
81+
;;
82+
esac
83+
done
84+
85+
if [ -z "$eessi_version" ]; then
86+
echo "ERROR: --eessi-version is required" >&2
87+
return 1
88+
fi
89+
90+
# Let's start from a clean slate
91+
module --force purge
92+
if [ -n "$accelerator_target_override" ]; then
93+
export EESSI_ACCELERATOR_TARGET_OVERRIDE="$accelerator_target_override"
94+
fi
95+
# Load the EESSI module
96+
module load EESSI/$eessi_version
97+
# Access the installed EESSI-extend (if an installation path was provided)
98+
if [ -n "$eessi_extend_installation_path" ]; then
99+
module use "$eessi_extend_installation_path"/modules/all
100+
fi
101+
check_disallowed_env_prefix EASYBUILD_
102+
}

.github/workflows/tests_eessi_extend_module.yml

Lines changed: 113 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ jobs:
3030
eessi_stack_version: ${{matrix.eessi_version}}
3131
use_eessi_module: true
3232

33-
- name: Install the EESSI-extend shipped with the repository and verify it is consistent with the CVMFS repo
33+
- name: Set the installation path for EESSI-extend
34+
run: |
35+
# Configuration item used throughout this workflow:
36+
# adjust this to change where EESSI-extend is (re)built and picked up from
37+
echo "MY_INSTALLATION_PATH=/tmp/easybuild" >> "$GITHUB_ENV"
38+
39+
- name: Install the EESSI-extend shipped with the repository
3440
run: |
3541
# Define a function to check the values of environment variables
3642
# and another that checks an environment does not contain environment
@@ -48,56 +54,19 @@ jobs:
4854
4955
# Load EasyBuild to install EESSI-extend
5056
module load EasyBuild
51-
# Set an installation path
52-
export MY_INSTALLATION_PATH=/tmp/easybuild
5357
export EASYBUILD_PREFIX=$MY_INSTALLATION_PATH
5458
eb EESSI-extend-easybuild.eb --rebuild
5559
module unload EasyBuild
5660
57-
# Verify that we can pick the installed version up
58-
module use $MY_INSTALLATION_PATH/modules/all
59-
# Verify we can run "module show" on the module
60-
module show EESSI-extend/${{matrix.eessi_version}}-easybuild
61-
# Now load it and run additional checks
62-
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
63-
echo $EBROOTEESSIMINEXTEND | grep $MY_INSTALLATION_PATH || { echo "ERROR: Installed version of EESSI-extend not picked up (loaded $EBROOTEESSIMINEXTEND)" >&2; exit 1; }
64-
# Do a test rebuild (with default and local hooks)
65-
echo "Testing a rebuild using the hooks shipped with EESSI"
66-
eb --rebuild ${{matrix.rebuild_software}}
67-
echo "Testing a rebuild using the hooks in the current branch"
68-
eb --rebuild --hooks=./eb_hooks.py ${{matrix.rebuild_software}}
69-
70-
# First, check if it differs against what is currently shipped by CVMFS
71-
diff <(grep -v '^local root = ' /cvmfs/software.eessi.io/versions/${{matrix.eessi_version}}/software/linux/$(uname -m)/generic/modules/all/EESSI-extend/${{matrix.eessi_version}}-easybuild.lua) <(grep -v '^local root = ' $MY_INSTALLATION_PATH/modules/all/EESSI-extend/${{matrix.eessi_version}}-easybuild.lua)
72-
# Then do a consistency check in CVMFS for all architectures
73-
.github/workflows/scripts/diff_eessi_extend.sh
74-
75-
# Proceed with unload and checking the environment variables
76-
module unload EESSI-extend
77-
# That should have unset all EasyBuild envvars (including EASYBUILD_PREFIX)
78-
check_disallowed_env_prefix EASYBUILD_
79-
module unuse $MY_INSTALLATION_PATH/modules/all
80-
81-
- name: Run tests for EESSI-extend in the various CPU-only scenarios
61+
- name: Run tests for EESSI-extend in the CVMFS install scenario
8262
run: |
83-
export MY_INSTALLATION_PATH=/tmp/easybuild
84-
85-
# Define a function to check the values of environment variables
86-
# and another that checks an environment does not contain environment
87-
# variables matching a certain pattern
8863
source .github/workflows/scripts/test_utils.sh
89-
90-
# Let's start from a clean slate
91-
module --force purge
92-
module load EESSI/${{matrix.eessi_version}}
93-
# Access the installed EESSI-extend
94-
module use "$MY_INSTALLATION_PATH"/modules/all
95-
check_disallowed_env_prefix EASYBUILD_
64+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
9665
9766
# Configure for CVMFS install
98-
echo "Checking EESSI-extend CVMFS install"
9967
export EESSI_CVMFS_INSTALL=1
10068
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
69+
echo $EBROOTEESSIMINEXTEND | grep $MY_INSTALLATION_PATH || { echo "ERROR: Installed version of EESSI-extend not picked up (loaded $EBROOTEESSIMINEXTEND)" >&2; exit 1; }
10170
# check some common EasyBuild settings
10271
check_env_var "EASYBUILD_READ_ONLY_INSTALLDIR" "1"
10372
check_env_var "EASYBUILD_ALLOW_LOADED_MODULES" "EasyBuild,EESSI-extend"
@@ -126,8 +95,12 @@ jobs:
12695
check_disallowed_env_prefix EASYBUILD_
12796
unset EESSI_CVMFS_INSTALL
12897
129-
# Now configure for a site
130-
echo "Checking EESSI-extend site install"
98+
- name: Run tests for EESSI-extend in the site install scenario
99+
run: |
100+
source .github/workflows/scripts/test_utils.sh
101+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
102+
103+
# Configure for a site install
131104
export EESSI_SITE_INSTALL=1
132105
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
133106
# check some specific envvars
@@ -140,8 +113,12 @@ jobs:
140113
check_disallowed_env_prefix EASYBUILD_
141114
unset EESSI_SITE_INSTALL
142115
143-
# Now for a project
144-
echo "Checking EESSI-extend project install"
116+
- name: Run tests for EESSI-extend in the project install scenario
117+
run: |
118+
source .github/workflows/scripts/test_utils.sh
119+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
120+
121+
# Configure for a project install
145122
export EESSI_PROJECT_INSTALL="$MY_INSTALLATION_PATH"
146123
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
147124
# check some specific envvars
@@ -156,8 +133,12 @@ jobs:
156133
check_disallowed_env_prefix EASYBUILD_
157134
unset EESSI_PROJECT_INSTALL
158135
159-
# Now for a user
160-
echo "Checking EESSI-extend user install"
136+
- name: Run tests for EESSI-extend in the user install scenario
137+
run: |
138+
source .github/workflows/scripts/test_utils.sh
139+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
140+
141+
# Configure for a user install
161142
export EESSI_USER_INSTALL="$MY_INSTALLATION_PATH/$USER"
162143
mkdir -p $EESSI_USER_INSTALL # must exist
163144
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
@@ -172,29 +153,33 @@ jobs:
172153
check_disallowed_env_prefix EASYBUILD_
173154
unset EESSI_USER_INSTALL
174155
175-
- name: Run tests for EESSI-extend in the various GPU scenarios
156+
- name: Run tests for EESSI-extend in the EasyBuild hooks override scenario
176157
run: |
177-
export MY_INSTALLATION_PATH=/tmp/easybuild
178-
179-
# Define a function to check the values of environment variables
180-
# and another that checks an environment does not contain environment
181-
# variables matching a certain pattern
182158
source .github/workflows/scripts/test_utils.sh
183-
184-
# Set an environment variable to use when we want to target accelerators
185-
export STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE="accel/nvidia/cc80"
186-
export STORED_CUDA_CC="8.0"
159+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
187160
188-
# Let's start from a clean slate
189-
module --force purge
190-
export EESSI_ACCELERATOR_TARGET_OVERRIDE=$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE
191-
module load EESSI/${{matrix.eessi_version}}
192-
# Access the installed EESSI-extend
193-
module use "$MY_INSTALLATION_PATH"/modules/all
161+
# Test overriding the EasyBuild hooks
162+
export EESSI_EASYBUILD_HOOKS_OVERRIDE="$GITHUB_WORKSPACE/eb_hooks.py"
163+
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
164+
check_env_var "EASYBUILD_HOOKS" "$EESSI_EASYBUILD_HOOKS_OVERRIDE"
165+
module unload EESSI-extend
194166
check_disallowed_env_prefix EASYBUILD_
167+
unset EESSI_EASYBUILD_HOOKS_OVERRIDE
168+
169+
- name: Set accelerator target override environment variables for GPU tests
170+
run: |
171+
echo "STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE=accel/nvidia/cc80" >> "$GITHUB_ENV"
172+
echo "STORED_CUDA_CC=8.0" >> "$GITHUB_ENV"
173+
174+
- name: Run tests for EESSI-extend with accelerators in the CVMFS install scenario
175+
run: |
176+
source .github/workflows/scripts/test_utils.sh
177+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} \
178+
--installation-path "$MY_INSTALLATION_PATH" \
179+
--accelerator-target "$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE" \
180+
--cuda-cc "$STORED_CUDA_CC"
195181
196182
# Configure for CVMFS install
197-
echo "Checking EESSI-extend CVMFS install"
198183
export EESSI_CVMFS_INSTALL=1
199184
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
200185
check_env_var "EASYBUILD_INSTALLPATH" "$EESSI_SOFTWARE_PATH" # installation path should be the same unless we ask for an explicit GPU installation
@@ -212,8 +197,15 @@ jobs:
212197
unset EESSI_ACCELERATOR_INSTALL
213198
unset EESSI_CVMFS_INSTALL
214199
215-
# Now configure for a site
216-
echo "Checking EESSI-extend site install"
200+
- name: Run tests for EESSI-extend with accelerators in the site install scenario
201+
run: |
202+
source .github/workflows/scripts/test_utils.sh
203+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} \
204+
--installation-path "$MY_INSTALLATION_PATH" \
205+
--accelerator-target "$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE" \
206+
--cuda-cc "$STORED_CUDA_CC"
207+
208+
# Configure for a site install
217209
export EESSI_SITE_INSTALL=1
218210
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
219211
check_env_var "EASYBUILD_INSTALLPATH" "$EESSI_SITE_SOFTWARE_PATH" # installation path should be the same unless we ask for an explicit GPU installation
@@ -231,8 +223,15 @@ jobs:
231223
unset EESSI_ACCELERATOR_INSTALL
232224
unset EESSI_SITE_INSTALL
233225
234-
# Now for a project
235-
echo "Checking EESSI-extend project install"
226+
- name: Run tests for EESSI-extend with accelerators in the project install scenario
227+
run: |
228+
source .github/workflows/scripts/test_utils.sh
229+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} \
230+
--installation-path "$MY_INSTALLATION_PATH" \
231+
--accelerator-target "$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE" \
232+
--cuda-cc "$STORED_CUDA_CC"
233+
234+
# Configure for a project install
236235
export EESSI_PROJECT_INSTALL="$MY_INSTALLATION_PATH"
237236
export EXPECTED_INSTALLATION_PATH="$MY_INSTALLATION_PATH/versions/$EESSI_VERSION/software/linux/$EESSI_SOFTWARE_SUBDIR"
238237
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
@@ -241,7 +240,7 @@ jobs:
241240
check_env_var "EASYBUILD_CUDA_COMPUTE_CAPABILITIES" "$STORED_CUDA_CC"
242241
module unload EESSI-extend
243242
export EESSI_ACCELERATOR_INSTALL=1
244-
module load EESSI-extend/${{matrix.eessi_version}}-easybuild # reload for an GPU actual installation
243+
module load EESSI-extend/${{matrix.eessi_version}}-easybuild # reload for an actual GPU installation
245244
check_env_var "EASYBUILD_INSTALLPATH" "$EXPECTED_INSTALLATION_PATH" # installation path should be the same for project case
246245
check_env_var "EESSI_ACCELERATOR_TARGET" "$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE"
247246
check_env_var "EASYBUILD_CUDA_COMPUTE_CAPABILITIES" "$STORED_CUDA_CC"
@@ -251,14 +250,20 @@ jobs:
251250
unset EESSI_ACCELERATOR_INSTALL
252251
unset EESSI_PROJECT_INSTALL
253252
254-
# Now for a user
255-
echo "Checking EESSI-extend user install"
253+
- name: Run tests for EESSI-extend with accelerators in the user install scenario
254+
run: |
255+
source .github/workflows/scripts/test_utils.sh
256+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} \
257+
--installation-path "$MY_INSTALLATION_PATH" \
258+
--accelerator-target "$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE" \
259+
--cuda-cc "$STORED_CUDA_CC"
260+
261+
# Configure for a user install
256262
export EESSI_USER_INSTALL="$MY_INSTALLATION_PATH/$USER"
257263
mkdir -p $EESSI_USER_INSTALL # must exist
258264
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
259265
# check some specific envvars
260266
export EXPECTED_INSTALLATION_PATH="$MY_INSTALLATION_PATH/$USER/versions/$EESSI_VERSION/software/linux/$EESSI_SOFTWARE_SUBDIR"
261-
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
262267
check_env_var "EASYBUILD_INSTALLPATH" "$EXPECTED_INSTALLATION_PATH" # installation path should be the same unless we ask for an explicit GPU installation
263268
check_env_var "EESSI_ACCELERATOR_TARGET" "$STORED_EESSI_ACCELERATOR_TARGET_OVERRIDE"
264269
check_env_var "EASYBUILD_CUDA_COMPUTE_CAPABILITIES" "$STORED_CUDA_CC"
@@ -272,4 +277,39 @@ jobs:
272277
module unload EESSI-extend
273278
check_disallowed_env_prefix EASYBUILD_
274279
unset EESSI_ACCELERATOR_INSTALL
275-
unset EESSI_USER_INSTALL
280+
unset EESSI_USER_INSTALL
281+
282+
- name: Dryrun tests with hooks from github and hooks from the CVMFS repo
283+
run: |
284+
source .github/workflows/scripts/test_utils.sh
285+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
286+
287+
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
288+
# Do a test rebuild (with default and local hooks)
289+
echo "Testing a rebuild using the hooks shipped with EESSI"
290+
eb --rebuild ${{matrix.rebuild_software}}
291+
echo "Testing a rebuild using the hooks in the current branch"
292+
eb --rebuild --hooks=./eb_hooks.py ${{matrix.rebuild_software}}
293+
# unload and check the environment is clean again
294+
module unload EESSI-extend
295+
check_disallowed_env_prefix EASYBUILD_
296+
297+
- name: Verify the EESSI-extend module is consistent with the CVMFS repo
298+
run: |
299+
source .github/workflows/scripts/test_utils.sh
300+
init_eessi_environment --eessi-version ${{matrix.eessi_version}} --installation-path "$MY_INSTALLATION_PATH"
301+
302+
# Verify we can run "module show" on the module
303+
module show EESSI-extend/${{matrix.eessi_version}}-easybuild
304+
# Now load it and run additional checks
305+
module load EESSI-extend/${{matrix.eessi_version}}-easybuild
306+
307+
# First, check if it differs against what is currently shipped by CVMFS
308+
diff <(grep -v '^local root = \|^-- Built with EasyBuild version' /cvmfs/software.eessi.io/versions/${{matrix.eessi_version}}/software/linux/$(uname -m)/generic/modules/all/EESSI-extend/${{matrix.eessi_version}}-easybuild.lua) <(grep -v '^local root = \|^-- Built with EasyBuild version' $MY_INSTALLATION_PATH/modules/all/EESSI-extend/${{matrix.eessi_version}}-easybuild.lua)
309+
# Then do a consistency check in CVMFS for all architectures
310+
.github/workflows/scripts/diff_eessi_extend.sh
311+
312+
# Proceed with unload and checking the environment variables
313+
module unload EESSI-extend
314+
# That should have unset all EasyBuild envvars (including EASYBUILD_PREFIX)
315+
check_disallowed_env_prefix EASYBUILD_

EESSI-extend-easybuild.eb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ setenv ("EASYBUILD_SYSROOT", sysroot)
205205
setenv ("EASYBUILD_PREFIX", pathJoin(working_dir, "easybuild"))
206206
setenv ("EASYBUILD_INSTALLPATH", easybuild_installpath)
207207
eessi_init_prefix = os.getenv("EESSI_INIT_PREFIX") or pathJoin(os.getenv("EESSI_PREFIX"), "init")
208-
setenv ("EASYBUILD_HOOKS", pathJoin(eessi_init_prefix, "easybuild", "eb_hooks.py"))
208+
eessi_easybuild_hooks_override = os.getenv("EESSI_EASYBUILD_HOOKS_OVERRIDE")
209+
if (eessi_easybuild_hooks_override ~= nil) then
210+
setenv ("EASYBUILD_HOOKS", eessi_easybuild_hooks_override)
211+
else
212+
setenv ("EASYBUILD_HOOKS", pathJoin(eessi_init_prefix, "easybuild", "eb_hooks.py"))
213+
end
209214
210215
-- Make sure to use the general umask that allows a global read
211216
setenv ("EASYBUILD_UMASK", "022")

0 commit comments

Comments
 (0)