Skip to content

Commit 6a73f1c

Browse files
authored
Merge pull request #33 from EESSI/ocaisa-patch-4
Allow using Lmod initialisation for EESSI
2 parents ca3a16a + d22ac20 commit 6a73f1c

File tree

2 files changed

+61
-8
lines changed

2 files changed

+61
-8
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: ubuntu-minimal_usage-lmod_init
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *' # Runs once a day at midnight UTC
5+
workflow_dispatch: # Allows manual triggering
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
# Declare default permissions as read only.
13+
permissions: read-all
14+
jobs:
15+
minimal_usage:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-24.04-arm
21+
- ubuntu-24.04
22+
- ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- uses: ./
26+
with:
27+
use_eessi_module: true
28+
init_direnv: false
29+
- name: Test EESSI
30+
run: |
31+
module avail
32+
module list |& grep "EESSI/"
33+
shell: bash
34+
- name: Test available repos
35+
run: |
36+
ls /cvmfs/software.eessi.io
37+
ls /cvmfs/dev.eessi.io
38+
shell: bash

action.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ inputs:
1212
description: 'Comma-separated list of fully qualified repository names that shall be mountable under /cvmfs.'
1313
required: false
1414
default: 'software.eessi.io,dev.eessi.io'
15+
use_eessi_module:
16+
description: 'Use the EESSI module to initialise EESSI (rather than sourcing a bash script), valid values are true or false'
17+
required: false
18+
default: 'false'
19+
init_direnv:
20+
description: 'Enable direnv initialisation for the repository, valid values are true or false'
21+
required: false
22+
default: 'true'
1523

1624
runs:
1725
using: "composite"
@@ -26,17 +34,23 @@ runs:
2634
run: |
2735
if [ "$RUNNER_OS" == "Linux" ]; then
2836
echo 'unset BASH_ENV' >> $HOME/env_config.export
29-
echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/bash" >> $HOME/env_config.export
37+
if [[ "${{ inputs.use_eessi_module }}" == "true" ]]; then
38+
echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/lmod/bash" >> $HOME/env_config.export
39+
else
40+
echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/bash" >> $HOME/env_config.export
41+
fi
3042
# allow oversubscription for OpenMPI
3143
echo "export OMPI_MCA_rmaps_base_oversubscribe=1" >> $HOME/env_config.export
32-
sudo apt install -y direnv
33-
echo 'eval "$(direnv export bash)"' >> $HOME/env_config.export
34-
mkdir -p $HOME/direnv/
35-
echo "[whitelist]" >> $HOME/direnv/direnv.toml
36-
echo "prefix = [ '$GITHUB_WORKSPACE' ]" >> $HOME/direnv/direnv.toml
37-
cp $HOME/direnv/direnv.toml $HOME/direnv/config.toml
44+
if [[ "${{ inputs.init_direnv }}" == "true" ]]; then
45+
sudo apt install -y direnv
46+
echo 'eval "$(direnv export bash)"' >> $HOME/env_config.export
47+
mkdir -p $HOME/direnv/
48+
echo "[whitelist]" >> $HOME/direnv/direnv.toml
49+
echo "prefix = [ '$GITHUB_WORKSPACE' ]" >> $HOME/direnv/direnv.toml
50+
cp $HOME/direnv/direnv.toml $HOME/direnv/config.toml
51+
echo "DIRENV_CONFIG=$HOME/direnv" >> $GITHUB_ENV
52+
fi
3853
echo "BASH_ENV=$HOME/env_config.export" >> $GITHUB_ENV
39-
echo "DIRENV_CONFIG=$HOME/direnv" >> $GITHUB_ENV
4054
elif [ "$RUNNER_OS" == "macOS" ]; then
4155
# EESSI on macOS requires lima so we get a Linux VM, see https://gitlab.com/eessi/support/-/issues/70
4256
# (unfortunately this requires nested virtualisation in GitHub Actions which is not available with M1)
@@ -51,3 +65,4 @@ runs:
5165
shell: bash
5266
env:
5367
EESSI_STACK_VERSION: ${{ inputs.eessi_stack_version }}
68+

0 commit comments

Comments
 (0)