Skip to content

Commit 1b28735

Browse files
authored
Merge pull request #3958 from boegel/container_test
add end2end test for 'eb --containerize'
2 parents a89b48e + bdd34dd commit 1b28735

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
2+
name: Tests for container support
3+
on: [push, pull_request]
4+
jobs:
5+
build:
6+
# stick to Ubuntu 18.04, where we can still easily install yum via 'apt-get install'
7+
runs-on: ubuntu-18.04
8+
strategy:
9+
matrix:
10+
python: [2.7, 3.6]
11+
fail-fast: false
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{matrix.python}}
19+
architecture: x64
20+
21+
- name: install OS & Python packages
22+
run: |
23+
# for building Singularity images
24+
sudo apt-get install rpm
25+
sudo apt-get install yum
26+
# for modules tool
27+
sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev
28+
# fix for lua-posix packaging issue, see https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082
29+
# needed for Ubuntu 18.04, but not for Ubuntu 20.04, so skipping symlinking if posix.so already exists
30+
if [ ! -e /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so ] ; then
31+
sudo ln -s /usr/lib/x86_64-linux-gnu/lua/5.2/posix_c.so /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so
32+
fi
33+
34+
- name: install Lmod
35+
run: |
36+
# avoid downloading modules tool sources into easybuild-framework dir
37+
cd $HOME
38+
export INSTALL_DEP=$GITHUB_WORKSPACE/easybuild/scripts/install_eb_dep.sh
39+
# install Lmod
40+
source $INSTALL_DEP Lmod-8.4.27 $HOME
41+
# changes in environment are not passed to other steps, so need to create files...
42+
echo $MOD_INIT > mod_init
43+
echo $PATH > path
44+
if [ ! -z $MODULESHOME ]; then echo $MODULESHOME > moduleshome; fi
45+
46+
# see https://github.com/apptainer/singularity/issues/5390#issuecomment-899111181
47+
- name: install Singularity
48+
run: |
49+
# install alien, which can be used to convert RPMs to Debian packages
50+
sudo apt-get install alien
51+
alien --version
52+
# determine latest version of Singularity available in EPEL, and download RPM
53+
singularity_rpm=$(curl -sL https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/ | grep singularity | sed 's/.*singularity/singularity/g' | sed 's/rpm.*/rpm/g')
54+
curl -OL https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/${singularity_rpm}
55+
# convert Singularity RPM to Debian package, and install it
56+
sudo alien -d ${singularity_rpm}
57+
sudo apt install ./singularity*.deb
58+
singularity --version
59+
60+
- name: install sources
61+
run: |
62+
# install from source distribution tarball, to test release as published on PyPI
63+
python setup.py sdist
64+
ls dist
65+
export PREFIX=/tmp/$USER/$GITHUB_SHA
66+
pip install --prefix $PREFIX dist/easybuild-framework*tar.gz
67+
pip install --prefix $PREFIX https://github.com/easybuilders/easybuild-easyblocks/archive/develop.tar.gz
68+
69+
- name: run test
70+
run: |
71+
# run tests *outside* of checked out easybuild-framework directory,
72+
# to ensure we're testing installed version (see previous step)
73+
cd $HOME
74+
# initialize environment for modules tool
75+
if [ -f $HOME/moduleshome ]; then export MODULESHOME=$(cat $HOME/moduleshome); fi
76+
source $(cat $HOME/mod_init); type module
77+
# make sure 'eb' is available via $PATH, and that $PYTHONPATH is set (some tests expect that);
78+
# also pick up changes to $PATH set by sourcing $MOD_INIT
79+
export PREFIX=/tmp/$USER/$GITHUB_SHA
80+
export PATH=$PREFIX/bin:$(cat $HOME/path)
81+
export PYTHONPATH=$PREFIX/lib/python${{matrix.python}}/site-packages:$PYTHONPATH
82+
eb --version
83+
# create $HOME/.rpmmacros, see also https://github.com/apptainer/singularity/issues/241
84+
echo '%_var /var' > $HOME/.rpmmacros
85+
echo '%_dbpath %{_var}/lib/rpm' >> $HOME/.rpmmacros
86+
# build CentOS 7 container image for bzip2 1.0.8 using EasyBuild;
87+
# see https://docs.easybuild.io/en/latest/Containers.html
88+
curl -OL https://raw.githubusercontent.com/easybuilders/easybuild-easyconfigs/develop/easybuild/easyconfigs/b/bzip2/bzip2-1.0.8.eb
89+
export EASYBUILD_CONTAINERPATH=$PWD
90+
export EASYBUILD_CONTAINER_CONFIG='bootstrap=yum,osversion=7'
91+
eb bzip2-1.0.8.eb --containerize --experimental --container-build-image
92+
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)
93+
singularity exec bzip2-1.0.8.sif bzip2 --help

0 commit comments

Comments
 (0)