-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new init scripts for new initialization module #668
Changes from 17 commits
d512675
7f71c28
1e2f154
a0c4377
68aea9f
788375d
b14cef8
1aa8cb8
0b6bc54
4aa7d00
71543e3
ea32ffe
bb3c8bd
385aee0
461c941
aee306c
6d7fde5
fcf4937
032cdae
33b6b92
d4bc3bc
63482f5
7f95d5e
a2ce628
2ab75c3
7c798d4
8d74aea
596f605
462f180
68ad3af
bccd55a
7ad306a
1b38cec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
EESSI_VERSION="2023.06" | ||
export LMOD_PAGER=cat | ||
|
||
# initialize assert framework | ||
if [ ! -d assert.sh ]; then | ||
echo "assert.sh not cloned." | ||
echo "" | ||
echo "run \`git clone https://github.com/lehmannro/assert.sh.git\`" | ||
exit 1 | ||
fi | ||
. assert.sh/assert.sh | ||
|
||
SHELLS=$@ | ||
|
||
for shell in ${SHELLS[@]}; do | ||
echo = | awk 'NF += (OFS = $_) + 100' | ||
echo RUNNING TESTS FOR SHELL: $shell | ||
echo = | awk 'NF += (OFS = $_) + 100' | ||
|
||
# TEST 1: Source Script and check Module Output | ||
assert "$shell -c 'source init/$shell' 2>&1 " "EESSI/$EESSI_VERSION loaded successfully" | ||
# TEST 2: Check PS1 Prompt (Previous exported) | ||
PROMPT="${shell^^}_PROMPT" | ||
assert "echo ${!PROMPT}" "{EESSI $EESSI_VERSION}" | ||
# Test 3: Check module overview | ||
MODULE_SECTIONS=($($shell -c "source init/$shell 2>/dev/null; module ov 2>&1 | grep -e '---'")) | ||
assert "echo ${MODULE_SECTIONS[1]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/modules/all" | ||
assert "echo ${MODULE_SECTIONS[4]}" "/cvmfs/software.eessi.io/versions/$EESSI_VERSION/init/modules" | ||
# Test 4: Load Python module and check version and path | ||
command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; python --version'" | ||
expected="Python 3.10.8" | ||
assert "$command" "$expected" | ||
command="$shell -c 'source init/$shell 2>/dev/null; module load Python/3.10.8-GCCcore-12.2.0; which python'" | ||
expected="/cvmfs/software.eessi.io/versions/$EESSI_VERSION/software/linux/x86_64/intel/haswell/software/Python/3.10.8-GCCcore-12.2.0/bin/python" | ||
assert "$command" "$expected" | ||
done | ||
|
||
assert_end source_eessi | ||
|
||
# RESET PAGER | ||
export LMOD_PAGER= |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions | ||
name: Check for EESSI init shell scripts to load eessi software module in software.eessi.io | ||
on: | ||
push: | ||
branches: [ "*-software.eessi.io" ] | ||
pull_request: | ||
workflow_dispatch: | ||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
EESSI_VERSION: | ||
- 2023.06 | ||
EESSI_SOFTWARE_SUBDIR_OVERRIDE: | ||
- x86_64/haswell | ||
MaKaNu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
steps: | ||
- name: Check out software-layer repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Mount EESSI CernVM-FS pilot repository | ||
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 | ||
with: | ||
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb | ||
cvmfs_http_proxy: DIRECT | ||
cvmfs_repositories: software.eessi.io | ||
|
||
- name: Clone assert.sh script | ||
run: git clone https://github.com/lehmannro/assert.sh.git | ||
|
||
- name: Install missing shells | ||
run: | | ||
sudo apt update | ||
sudo apt install zsh ksh fish | ||
echo "# INIT ZSH" > ~/.zshrc | ||
|
||
- name: Prepare PROMPT variables | ||
run: | | ||
export BASH_PROMPT=$(bash -c 'source init/bash; echo "$PS1"') | ||
export ZSH_PROMPT=$(zsh -c 'source init/zsh; echo "$PS1"') | ||
export KSH_PROMPT=$(ksh -c 'source init/ksh; echo "$PS1"') | ||
export FISH_PROMPT=$(fish -c 'source init/fish; echo "$PS1"') | ||
|
||
- name: Run tests for available shells | ||
run: | | ||
.github/workflows/scripts/test_init_scripts.sh "bash" "zsh" "ksh" "fish" | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,41 +1,17 @@ | ||||||
function show_msg { | ||||||
# only echo msg if EESSI_SILENT is unset | ||||||
msg=$1 | ||||||
if [[ -z ${EESSI_SILENT+x} ]]; then | ||||||
echo "$msg" | ||||||
fi | ||||||
} | ||||||
|
||||||
# The following method should be safe, but might break if file is a symlink | ||||||
# (could switch to $(dirname "$(readlink -f "$BASH_SOURCE")") in that case) | ||||||
source $(dirname "$BASH_SOURCE")/eessi_environment_variables | ||||||
|
||||||
# only continue if setting EESSI environment variables worked fine | ||||||
if [ $? -eq 0 ]; then | ||||||
|
||||||
export PS1="{EESSI $EESSI_VERSION} $PS1" | ||||||
|
||||||
# add location of commands provided by compat layer to $PATH; | ||||||
# see https://github.com/EESSI/software-layer/issues/52 | ||||||
export PATH=$EPREFIX/usr/bin:$EPREFIX/bin:$PATH | ||||||
|
||||||
# init Lmod | ||||||
show_msg "Initializing Lmod..." | ||||||
source $EESSI_EPREFIX/usr/share/Lmod/init/bash | ||||||
|
||||||
# prepend location of modules for EESSI software stack to $MODULEPATH | ||||||
show_msg "Prepending $EESSI_MODULEPATH to \$MODULEPATH..." | ||||||
module use $EESSI_MODULEPATH | ||||||
show_msg "Prepending site path $EESSI_SITE_MODULEPATH to \$MODULEPATH..." | ||||||
module use $EESSI_SITE_MODULEPATH | ||||||
|
||||||
#show_msg "" | ||||||
#show_msg "*** Known problems in the ${EESSI_VERSION} software stack ***" | ||||||
#show_msg "" | ||||||
#show_msg "1) ..." | ||||||
#show_msg "" | ||||||
#show_msg "" | ||||||
|
||||||
echo "Environment set up to use EESSI (${EESSI_VERSION}), have fun!" | ||||||
|
||||||
# Choose an EESSI version | ||||||
EESSI_VERSION="${EESSI_VERSION:-2023.06}" | ||||||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
# Path to top-level module tree | ||||||
export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules | ||||||
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/bash | ||||||
|
||||||
export PS1 | ||||||
if [ -z "$__Init_Default_Modules" ]; then | ||||||
export __Init_Default_Modules=1; | ||||||
|
||||||
## ability to predefine elsewhere the default list | ||||||
LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} | ||||||
export LMOD_SYSTEM_DEFAULT_MODULES | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
You'll need this everywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some sites also force full name matching so you probably can't leave it versionless There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now implemented with Version number. It doesn't matter to me but like to understand the difference why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no existing |
||||||
module --initial_load --no_redirect restore | ||||||
else | ||||||
module refresh | ||||||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Choose an EESSI version | ||
if (! $?EESSI_VERSION) then; set EESSI_VERSION = "2023.06"; endif | ||
# Path to top-level module tree | ||
setenv MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules | ||
source /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/`uname -m`/usr/share/Lmod/init/csh | ||
|
||
setenv PS1 $prompt | ||
if (! $?__Init_Default_Modules ) then | ||
setenv __Init_Default_Modules 1; | ||
|
||
## ability to predefine elsewhere the default list | ||
if (! $?LMOD_SYSTEM_DEFAULT_MODULES) then; setenv LMOD_SYSTEM_DEFAULT_MODULES "StdEnv"; endif | ||
module --initial_load --no_redirect restore | ||
else | ||
module refresh | ||
endif | ||
#module load "$LMOD_SYSTEM_DEFAULT_MODULES" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Choose an EESSI version | ||
set EESSI_VERSION (set -q EESSI_VERSION; and echo "$EESSI_VERSION"; or echo "2023.06") | ||
# Path to top-level module tree | ||
set -x MODULEPATH /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules | ||
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish | ||
|
||
export PS1 | ||
if test -z "$__Init_Default_Modules" | ||
export __Init_Default_Modules=1; | ||
|
||
## ability to predefine elsewhere the default list | ||
set -x LMOD_SYSTEM_DEFAULT_MODULES (set -q LMOD_SYSTEM_DEFAULT_MODULE; and echo "$LMOD_SYSTEM_DEFAULT_MODULE"; or echo "StdEnv") | ||
module --initial_load --no_redirect restore | ||
else | ||
module refresh | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Choose an EESSI version | ||
EESSI_VERSION="${EESSI_VERSION:-2023.06}" | ||
# Path to top-level module tree | ||
export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules | ||
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/ksh | ||
|
||
export PS1 | ||
if [ -z "$__Init_Default_Modules" ]; then | ||
export __Init_Default_Modules=1; | ||
|
||
## ability to predefine elsewhere the default list | ||
LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} | ||
export LMOD_SYSTEM_DEFAULT_MODULES | ||
module --initial_load --no_redirect restore | ||
else | ||
module refresh | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
load("EESSI/2023.06") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Choose an EESSI version | ||
EESSI_VERSION="${EESSI_VERSION:-2023.06}" | ||
# Path to top-level module tree | ||
export MODULEPATH=/cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/init/modules | ||
. /cvmfs/software.eessi.io/versions/"$EESSI_VERSION"/compat/linux/$(uname -m)/usr/share/Lmod/init/zsh | ||
|
||
export PS1 | ||
if [ -z "$__Init_Default_Modules" ]; then | ||
export __Init_Default_Modules=1; | ||
|
||
## ability to predefine elsewhere the default list | ||
LMOD_SYSTEM_DEFAULT_MODULES=${LMOD_SYSTEM_DEFAULT_MODULES:-"StdEnv"} | ||
export LMOD_SYSTEM_DEFAULT_MODULES | ||
module --initial_load --no_redirect restore | ||
else | ||
module refresh | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've got no guarantees what architecture you will end up with so better to override the architecture to give you something predictable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.