Skip to content

Commit 4b5bd66

Browse files
authored
Merge pull request #668 from MaKaNu/2023.06-software.eessi.io
Add new init scripts for new initialization module
2 parents 102d16f + 1b38cec commit 4b5bd66

File tree

8 files changed

+178
-0
lines changed

8 files changed

+178
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
EESSI_VERSION="2023.06"
3+
export LMOD_PAGER=cat
4+
5+
# initialize assert framework
6+
if [ ! -d assert.sh ]; then
7+
echo "assert.sh not cloned."
8+
echo ""
9+
echo "run \`git clone https://github.com/lehmannro/assert.sh.git\`"
10+
exit 1
11+
fi
12+
. assert.sh/assert.sh
13+
14+
TEST_SHELLS=("bash" "zsh" "fish" "ksh")
15+
SHELLS=$@
16+
17+
for shell in ${SHELLS[@]}; do
18+
echo = | awk 'NF += (OFS = $_) + 100'
19+
echo RUNNING TESTS FOR SHELL: $shell
20+
echo = | awk 'NF += (OFS = $_) + 100'
21+
if [[ ! " ${TEST_SHELLS[*]} " =~ [[:space:]]${shell}[[:space:]] ]]; then
22+
### EXCEPTION FOR CSH ###
23+
echo -e "\033[33mWe don't now how to test the shell '$shell', PRs are Welcome.\033[0m"
24+
else
25+
# TEST 1: Source Script and check Module Output
26+
assert "$shell -c 'source init/lmod/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully"
27+
# TEST 2: Check if module overviews first section is the loaded EESSI module
28+
MODULE_SECTIONS=($($shell -c "source init/lmod/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'"))
29+
PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/modules/all"
30+
assert_raises 'echo "${MODULE_SECTIONS[1]}" | grep -E "$PATTERN"'
31+
# TEST 3: Check if module overviews second section is the EESSI init module
32+
assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules"
33+
# Test 4: Load Python module and check version
34+
command="$shell -c 'source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'"
35+
expected="Python 3.10.8"
36+
assert "$command" "$expected"
37+
# Test 5: Load Python module and check path
38+
PYTHON_PATH=$($shell -c "source init/lmod/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python")
39+
PATTERN="/cvmfs/software\.eessi\.io/versions/$EESSI_VERSION/software/linux/x86_64/(intel/haswell|amd/zen3)/software/Python/3\.10\.8-GCCcore-12\.2\.0/bin/python"
40+
echo "$PYTHON_PATH" | grep -E "$PATTERN"
41+
assert_raises 'echo "$PYTHON_PATH" | grep -E "$PATTERN"'
42+
43+
#End Test Suite
44+
assert_end "source_eessi_$shell"
45+
fi
46+
done
47+
48+
49+
# RESET PAGER
50+
export LMOD_PAGER=
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
2+
name: Check for EESSI init shell scripts to load eessi software module in software.eessi.io
3+
on:
4+
push:
5+
branches: [ "*-software.eessi.io" ]
6+
pull_request:
7+
workflow_dispatch:
8+
permissions:
9+
contents: read # to fetch code (actions/checkout)
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
EESSI_VERSION:
17+
- 2023.06
18+
EESSI_SOFTWARE_SUBDIR_OVERRIDE:
19+
- x86_64/intel/haswell
20+
steps:
21+
- name: Check out software-layer repository
22+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
23+
24+
- name: Mount EESSI CernVM-FS pilot repository
25+
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
26+
with:
27+
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
28+
cvmfs_http_proxy: DIRECT
29+
cvmfs_repositories: software.eessi.io
30+
31+
- name: Clone assert.sh script
32+
run: git clone https://github.com/lehmannro/assert.sh.git
33+
34+
- name: Install missing shells
35+
run: |
36+
sudo apt update
37+
sudo apt install zsh ksh fish
38+
echo "# INIT ZSH" > ~/.zshrc
39+
40+
- name: Run tests for available shells
41+
run: |
42+
.github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" "csh"
43+

init/lmod/bash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Choose an EESSI version
2+
EESSI_VERSION="${EESSI_VERSION:-2023.06}"
3+
# Path to top-level module tree
4+
export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules
5+
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
6+
7+
if [ -z "$__Init_Default_Modules" ]; then
8+
export __Init_Default_Modules=1;
9+
10+
## ability to predefine elsewhere the default list
11+
LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"EESSI/$EESSI_VERSION"}
12+
export LMOD_SYSTEM_DEFAULT_MODULES
13+
module --initial_load --no_redirect restore
14+
else
15+
module refresh
16+
fi

init/lmod/csh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Choose an EESSI version
2+
if (! $?EESSI_VERSION) then; set EESSI_VERSION = "2023.06"; endif
3+
# Path to top-level module tree
4+
setenv MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules
5+
source /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/`uname -m`/usr/share/Lmod/init/csh
6+
7+
if (! $?__Init_Default_Modules ) then
8+
setenv __Init_Default_Modules 1;
9+
10+
## ability to predefine elsewhere the default list
11+
if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION"; endif
12+
module --initial_load --no_redirect restore
13+
else
14+
module refresh
15+
endif
16+

init/lmod/fish

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Choose an EESSI version
2+
set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06")
3+
# Path to top-level module tree
4+
set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules
5+
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish
6+
7+
if test -z "$__Init_Default_Modules"
8+
export __Init_Default_Modules=1;
9+
10+
## ability to predefine elsewhere the default list
11+
set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "EESSI/$EESSI_VERSION")
12+
module --initial_load --no_redirect restore
13+
else
14+
module refresh
15+
end

init/lmod/ksh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Choose an EESSI version
2+
EESSI_VERSION="${EESSI_VERSION:-2023.06}"
3+
# Path to top-level module tree
4+
export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules
5+
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh
6+
7+
if [ -z "$__Init_Default_Modules" ]; then
8+
export __Init_Default_Modules=1;
9+
10+
## ability to predefine elsewhere the default list
11+
LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"EESSI/$EESSI_VERSION"}
12+
export LMOD_SYSTEM_DEFAULT_MODULES
13+
module --initial_load --no_redirect restore
14+
else
15+
module refresh
16+
fi

init/lmod/zsh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Choose an EESSI version
2+
EESSI_VERSION="${EESSI_VERSION:-2023.06}"
3+
# Path to top-level module tree
4+
export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules
5+
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh
6+
7+
if [ -z "$__Init_Default_Modules" ]; then
8+
export __Init_Default_Modules=1;
9+
10+
## ability to predefine elsewhere the default list
11+
LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"EESSI/$EESSI_VERSION"}
12+
export LMOD_SYSTEM_DEFAULT_MODULES
13+
module --initial_load --no_redirect restore
14+
else
15+
module refresh
16+
fi

install_scripts.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ mc_files=(
108108
)
109109
copy_files_by_list ${TOPDIR}/init/modules/EESSI ${INSTALL_PREFIX}/init/modules/EESSI "${mc_files[@]}"
110110

111+
# Copy for init/lmod directory
112+
init_script_files=(
113+
bash zsh ksh fish csh
114+
)
115+
copy_files_by_list ${TOPDIR}/init/lmod ${INSTALL_PREFIX}/init/lmod "${init_script_files[@]}"
116+
111117
# Copy for the scripts directory
112118
script_files=(
113119
utils.sh

0 commit comments

Comments
 (0)