Appease hound #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions | |
name: Tests for Singularity container support | |
on: [push, pull_request] | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
concurrency: | |
group: ${{format('{0}:{1}:{2}', github.repository, github.ref, github.workflow)}} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python: [3.7] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python}} | |
architecture: x64 | |
- name: install OS & Python packages | |
run: | | |
# for modules tool | |
APT_PKGS="lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev" | |
# for building Singularity images | |
APT_PKGS+=" rpm dnf" | |
# Avoid apt-get update, as we don't really need it, | |
# and it does more harm than good (it's fairly expensive, and it results in flaky test runs) | |
if ! sudo apt-get install $APT_PKGS; then | |
# Try to update cache, then try again to resolve 404s of old packages | |
sudo apt-get update -yqq || true | |
sudo apt-get install $APT_PKGS | |
fi | |
- name: install Lmod | |
run: | | |
# avoid downloading modules tool sources into easybuild-framework dir | |
cd $HOME | |
export INSTALL_DEP=$GITHUB_WORKSPACE/easybuild/scripts/install_eb_dep.sh | |
# install Lmod | |
source $INSTALL_DEP Lmod-8.7.6 $HOME | |
# changes in environment are not passed to other steps, so need to create files... | |
echo $MOD_INIT > mod_init | |
echo $PATH > path | |
if [ ! -z $MODULESHOME ]; then echo $MODULESHOME > moduleshome; fi | |
# see https://github.com/apptainer/singularity/issues/5390#issuecomment-899111181 | |
- name: install Singularity | |
run: | | |
sudo apt-get update | |
# install alien, which can be used to convert RPMs to Debian packages | |
sudo apt-get install alien | |
alien --version | |
# determine latest version of Singularity available in EPEL, and download RPM | |
singularity_rpm=$(curl -sL https://dl.fedoraproject.org/pub/archive/epel/8.5/Everything/x86_64/Packages/s/ | grep singularity | sed 's/.*singularity/singularity/g' | sed 's/rpm.*/rpm/g') | |
curl -OL https://dl.fedoraproject.org/pub/archive/epel/8.5/Everything/x86_64/Packages/s/${singularity_rpm} | |
# convert Singularity RPM to Debian package, and install it | |
sudo alien -d ${singularity_rpm} | |
sudo apt-get install ./singularity*.deb | |
singularity --version | |
- name: install sources | |
run: | | |
# install from source distribution tarball, to test release as published on PyPI | |
python setup.py sdist | |
ls dist | |
export PREFIX=/tmp/$USER/$GITHUB_SHA | |
pip install --prefix $PREFIX dist/easybuild[-_]framework*tar.gz | |
pip install --prefix $PREFIX https://github.com/easybuilders/easybuild-easyblocks/archive/5.0.x.tar.gz | |
- name: run test | |
run: | | |
# run tests *outside* of checked out easybuild-framework directory, | |
# to ensure we're testing installed version (see previous step) | |
cd $HOME | |
# initialize environment for modules tool | |
if [ -f $HOME/moduleshome ]; then export MODULESHOME=$(cat $HOME/moduleshome); fi | |
source $(cat $HOME/mod_init); type module | |
# make sure 'eb' is available via $PATH, and that $PYTHONPATH is set (some tests expect that); | |
# also pick up changes to $PATH set by sourcing $MOD_INIT | |
export PREFIX=/tmp/$USER/$GITHUB_SHA | |
export PATH=$PREFIX/bin:$(cat $HOME/path) | |
export PYTHONPATH=$PREFIX/lib/python${{matrix.python}}/site-packages:$PYTHONPATH | |
eb --version | |
# create $HOME/.rpmmacros, see also https://github.com/apptainer/singularity/issues/241 | |
echo '%_var /var' > $HOME/.rpmmacros | |
echo '%_dbpath %{_var}/lib/rpm' >> $HOME/.rpmmacros | |
# build CentOS 7 container image for bzip2 1.0.8 using EasyBuild; | |
# see https://docs.easybuild.io/en/latest/Containers.html | |
curl -OL https://raw.githubusercontent.com/easybuilders/easybuild-easyconfigs/5.0.x/easybuild/easyconfigs/b/bzip2/bzip2-1.0.8.eb | |
export EASYBUILD_CONTAINERPATH=$PWD | |
export EASYBUILD_CONTAINER_CONFIG='bootstrap=docker,from=ghcr.io/easybuilders/centos-7.9-python3-amd64' | |
eb bzip2-1.0.8.eb --containerize --experimental --container-build-image | |
singularity exec bzip2-1.0.8.sif command -v bzip2 | grep '/app/software/bzip2/1.0.8/bin/bzip2' || (echo "Path to bzip2 '$which_bzip2' is not correct" && exit 1) | |
singularity exec bzip2-1.0.8.sif bzip2 --help |