Skip to content

Commit

Permalink
Added a draft CI tests for EESSI module
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Top committed Aug 15, 2024
1 parent 890c38b commit 19af8cf
Showing 1 changed file with 54 additions and 64 deletions.
118 changes: 54 additions & 64 deletions .github/workflows/tests_eessi_module.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,67 @@
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: Check for EESSI module functionality 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
- 2023.06
steps:
- name: Check out software-layer repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- 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: 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: Test for archdetect_cpu functionality with only one valid path
run: |
export MODULEPATH=/cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/modules/:$MODULEPATH
CPU_ARCH=$(./init/eessi_archdetect.sh cpupath)
export EESSI_ARCHDETECT_OPTIONS=dummy/cpu:$CPU_ARCH:dummy1/cpu1
if module load EESSI/${{matrix.EESSI_VERSION}}; then
if [[ $CPU_ARCH == "${EESSI_SOFTWARE_SUBDIR}" ]]; then
echo "Test for picking up on \$archdetect_cpu PASSED"
else
echo "Test for picking up on \$archdetdect_cpu FAILED" >&2
exit 1
fi
module unload EESSI/${{matrix.EESSI_VERSION}}
fi
unset EESSI_ARCHDETECT_OPTIONS
- name: Test for archdetect_cpu functionality with invalid path
run: |
export MODULEPATH=/cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/modules/:$MODULEPATH
export EESSI_ARCHDETECT_OPTIONS=dummy/cpu
outfile=outfile.txt
module load EESSI/${{matrix.EESSI_VERSION}} > $outfile 2>&1
result=$(grep "Software" $outfile)
if [[ "$result" == *"Software directory check for the detected architecture failed"* ]]; then
echo "Test for picking up invalid path on \$archdetect_cpu PASSED"
- name: Test for archdetect_cpu functionality with only one valid path
run: |
export MODULEPATH=/cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/modules/:$MODULEPATH
CPU_ARCH=$(./init/eessi_archdetect.sh cpupath)
export EESSI_ARCHDETECT_OPTIONS=dummy/cpu:$CPU_ARCH:dummy1/cpu1
if module load EESSI/${{matrix.EESSI_VERSION}}; then
if [[ $CPU_ARCH == "${EESSI_SOFTWARE_SUBDIR}" ]]; then
echo "Test for picking up on \$archdetect_cpu PASSED"
else
echo "Test for picking up invalid path on \$archdetect_cpu FAILED" >&2
exit 1
echo "Test for picking up on \$archdetect_cpu FAILED" >&2
exit 1
fi
rm $outfile
unset EESSI_ARCHDETECT_OPTIONS
module unload EESSI/${{matrix.EESSI_VERSION}}
fi
unset EESSI_ARCHDETECT_OPTIONS
- name: Test for expected variables after loading EESSI module
run: |
export MODULEPATH=/cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/modules/:$MODULEPATH
moduleoutfile=moduleout.txt
sourceoutfile=sourceout.txt
module load EESSI/${{matrix.EESSI_VERSION}}
env | grep -E '^(EESSI_S|EESSI_C)' | sort | > ${moduleoutfile}
module unload EESSI/${{matrix.EESSI_VERSION}}
source /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/bash
env | grep -E '^(EESSI_S|EESSI_C)' | sort | > ${sourceoutfile}
if (diff ${moduleoutfile} ${sourceoutfile} > /dev/null); then
echo "Test for checking env variables PASSED"
else
echo "Test for checking env variables FAILED" >&2
exit 1
fi
rm $moduleoutfile $sourceoutfile
- name: Test for archdetect_cpu functionality with invalid path
run: |
export MODULEPATH=/cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/modules/:$MODULEPATH
export EESSI_ARCHDETECT_OPTIONS=dummy/cpu
outfile=outfile.txt
module load EESSI/${{matrix.EESSI_VERSION}} > $outfile 2>&1
result=$(grep "Software" $outfile)
if [[ "$result" == *"Software directory check for the detected architecture failed"* ]]; then
echo "Test for picking up invalid path on \$archdetect_cpu PASSED"
else
echo "Test for picking up invalid path on \$archdetect_cpu FAILED" >&2
exit 1
fi
unset EESSI_ARCHDETECT_OPTIONS
- name: Test for expected variables after loading EESSI module
run: |
export MODULEPATH=/cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/modules/:$MODULEPATH
moduleoutfile=moduleout.txt
sourceoutfile=sourceout.txt
module load EESSI/${{matrix.EESSI_VERSION}}
env | grep -E '^(EESSI_S|EESSI_C)' | sort | > ${moduleoutfile}
module unload EESSI/${{matrix.EESSI_VERSION}}
source /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/init/bash
env | grep -E '^(EESSI_S|EESSI_C)' | sort | > ${sourceoutfile}
if (diff ${moduleoutfile} ${sourceoutfile} > /dev/null); then
echo "Test for checking env variables PASSED"
else
echo "Test for checking env variables FAILED" >&2
exit 1
fi

0 comments on commit 19af8cf

Please sign in to comment.