diff --git a/.github/workflows/minimal-usage.yml b/.github/workflows/minimal-usage.yml index 16a0788..694db84 100644 --- a/.github/workflows/minimal-usage.yml +++ b/.github/workflows/minimal-usage.yml @@ -30,6 +30,26 @@ jobs: shell: bash - name: Test available repos run: | + # Make sure an EESSI module is loaded + module list |& grep "EESSI/" ls /cvmfs/software.eessi.io ls /cvmfs/dev.eessi.io shell: bash + + test_mount_only: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ./ + with: + mount_cvmfs_only: 'true' + init_direnv: 'false' + - name: Test EESSI not initialised + run: | + if [[ -v EESSI_VERSION ]]; then + echo "EESSI_VERSION should not be set as this indicates EESSI is initialised" + exit 1 + fi + # Make sure CVMFS is mounted, and EESSI available + ls /cvmfs/software.eessi.io + shell: bash diff --git a/.github/workflows/minimal_usage_lmod_init.yml b/.github/workflows/minimal_usage_bash_init.yml similarity index 72% rename from .github/workflows/minimal_usage_lmod_init.yml rename to .github/workflows/minimal_usage_bash_init.yml index 7adb970..bc925a7 100644 --- a/.github/workflows/minimal_usage_lmod_init.yml +++ b/.github/workflows/minimal_usage_bash_init.yml @@ -1,4 +1,4 @@ -name: ubuntu-minimal_usage-lmod_init +name: ubuntu-minimal_usage-bash_script_init on: schedule: - cron: '0 0 * * *' # Runs once a day at midnight UTC @@ -12,7 +12,7 @@ on: # Declare default permissions as read only. permissions: read-all jobs: - minimal_usage: + minimal_usage_bash_script: runs-on: ${{ matrix.os }} strategy: matrix: @@ -24,12 +24,17 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: ./ with: - use_eessi_module: true + use_eessi_module: false init_direnv: false - name: Test EESSI run: | module avail - module list |& grep "EESSI/" + if ! module list |& grep -q "EESSI/"; then + echo "EESSI module is NOT loaded" + else + echo "EESSI module is loaded but shouldn't be" + exit 1 + fi shell: bash - name: Test available repos run: | diff --git a/README.md b/README.md index 7401333..68a9a8f 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ jobs: steps: - uses: actions/checkout@v6 - uses: eessi/github-action-eessi@v3 + with: + eessi_stack_version: '2025.06' - name: Test EESSI run: | module avail @@ -65,7 +67,10 @@ jobs: ## Optional Parameters The following parameters are supported: - `eessi_stack_version`: version of the EESSI stack to use (defaults to `2023.06`) -- `eessi_config_package`: location of the EESSI CernVM-FS configuration package (defaults to `https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb`). +- `eessi_repositories`: Comma separated list of EESSI repositories to make available (defaults to `software.eessi.io,dev.eessi.io`). +- `use_eessi_module`: Use the Lmod method to initialise EESSI (defaults to `true`) +- `mount_cvmfs_only`: Only mount the EESSI CernVM-FS repositories, do not initialise EESSI (defaults to `false`) +- `init_direnv`: Initialise direnv for the repository (defaults to `true`) ## Minimal Example diff --git a/action.yml b/action.yml index a015f66..8507083 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,10 @@ inputs: use_eessi_module: description: 'Use the EESSI module to initialise EESSI (rather than sourcing a bash script), valid values are true or false' required: false + default: 'true' + mount_cvmfs_only: + description: 'Only mount CVMFS, do not initialise EESSI' + required: false default: 'false' init_direnv: description: 'Enable direnv initialisation for the repository, valid values are true or false' @@ -31,13 +35,27 @@ runs: cvmfs_http_proxy: DIRECT cvmfs_repositories: 'cvmfs-config.cern.ch,${{ inputs.eessi_repositories }}' - id: install-eessi + shell: bash + env: + EESSI_STACK_VERSION: ${{ inputs.eessi_stack_version }} + ALLOWED_VERSIONS: "2023.06 2025.06" run: | if [ "$RUNNER_OS" == "Linux" ]; then echo 'unset BASH_ENV' >> $HOME/env_config.export - if [[ "${{ inputs.use_eessi_module }}" == "true" ]]; then - echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/lmod/bash" >> $HOME/env_config.export - else - echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/bash" >> $HOME/env_config.export + if [[ "${{ inputs.mount_cvmfs_only }}" == "false" ]]; then + [[ " $ALLOWED_VERSIONS " =~ " $EESSI_STACK_VERSION " ]] || { + echo "Invalid eessi_stack_version: '$EESSI_STACK_VERSION'" + echo "Allowed values: $ALLOWED_VERSIONS" + exit 1 + } + if [[ "${{ inputs.use_eessi_module }}" == "true" ]]; then + # Make the EESSI module sticky so that it persists in case `module purge` is used + # (while still allowing for a swap if needed) + echo "export EESSI_MODULE_STICKY=1" >> $HOME/env_config.export + echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/lmod/bash" >> $HOME/env_config.export + else + echo "source /cvmfs/software.eessi.io/versions/$EESSI_STACK_VERSION/init/bash" >> $HOME/env_config.export + fi fi # allow oversubscription for OpenMPI echo "export OMPI_MCA_rmaps_base_oversubscribe=1" >> $HOME/env_config.export @@ -62,7 +80,3 @@ runs: # limactl start eessi || true # cat /Users/runner/.lima/eessi/ha.stderr.log fi - shell: bash - env: - EESSI_STACK_VERSION: ${{ inputs.eessi_stack_version }} -