forked from easybuilders/easybuild-easyblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (144 loc) · 6.44 KB
/
unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: easyblocks unit tests
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-20.04
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
modules_tool: [Lmod-8.1.14, modules-tcl-1.147, modules-3.2.10, modules-4.1.4]
module_syntax: [Lua, Tcl]
# exclude some configuration for non-Lmod modules tool:
# - don't test with Lua module syntax (only supported in Lmod)
# - don't test with Python 3.7+ (only with 3.6), to limit test configurations
exclude:
- modules_tool: modules-tcl-1.147
module_syntax: Lua
- modules_tool: modules-3.2.10
module_syntax: Lua
- modules_tool: modules-4.1.4
module_syntax: Lua
- modules_tool: modules-tcl-1.147
python: 3.7
- modules_tool: modules-tcl-1.147
python: 3.8
- modules_tool: modules-tcl-1.147
python: 3.9
- modules_tool: modules-tcl-1.147
python: '3.10'
- modules_tool: modules-tcl-1.147
python: '3.11'
- modules_tool: modules-3.2.10
python: 3.7
- modules_tool: modules-3.2.10
python: 3.8
- modules_tool: modules-3.2.10
python: 3.9
- modules_tool: modules-3.2.10
python: '3.10'
- modules_tool: modules-3.2.10
python: '3.11'
- modules_tool: modules-4.1.4
python: 3.7
- modules_tool: modules-4.1.4
python: 3.8
- modules_tool: modules-4.1.4
python: 3.9
- modules_tool: modules-4.1.4
python: '3.10'
- modules_tool: modules-4.1.4
python: '3.11'
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python}}
architecture: x64
- name: install OS & Python packages
run: |
# disable apt-get update, we don't really need it,
# and it does more harm than good (it's fairly expensive, and it results in flaky test runs)
# sudo apt-get update
# for modules tool
sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev
# fix for lua-posix packaging issue, see https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082
# needed for Ubuntu 18.04, but not for Ubuntu 20.04, so skipping symlinking if posix.so already exists
if [ ! -e /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so ] ; then
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
fi
# for testing OpenMPI-system*eb we need to have Open MPI installed
sudo apt-get install libopenmpi-dev openmpi-bin
- name: install EasyBuild framework
run: |
# first determine which branch of easybuild-framework repo to install
BRANCH=5.0.x
if [ "x$GITHUB_BASE_REF" = 'xmain' ]; then BRANCH=main; fi
if [ "x$GITHUB_BASE_REF" = 'x5.0.x' ]; then BRANCH=5.0.x; fi
echo "Using easybuild-framework branch $BRANCH (\$GITHUB_BASE_REF $GITHUB_BASE_REF)"
git clone -b $BRANCH --depth 10 --single-branch https://github.com/easybuilders/easybuild-framework.git
cd easybuild-framework; git log -n 1; cd -
pip install $PWD/easybuild-framework
- name: install modules tool
run: |
cd $HOME
# use install_eb_dep.sh script provided with easybuild-framework
export INSTALL_DEP=$(which install_eb_dep.sh)
echo "Found install_eb_dep.sh script: $INSTALL_DEP"
# install modules tool
source $INSTALL_DEP ${{matrix.modules_tool}} $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
- 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-easyblocks*tar.gz
- name: run test suite
env:
EB_VERBOSE: 1
EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
run: |
# 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
# tell EasyBuild which modules tool is available
if [[ ${{matrix.modules_tool}} =~ ^modules-tcl- ]]; then
export EASYBUILD_MODULES_TOOL=EnvironmentModulesTcl
elif [[ ${{matrix.modules_tool}} =~ ^modules-3 ]]; then
export EASYBUILD_MODULES_TOOL=EnvironmentModulesC
elif [[ ${{matrix.modules_tool}} =~ ^modules-4 ]]; then
export EASYBUILD_MODULES_TOOL=EnvironmentModules
else
export EASYBUILD_MODULES_TOOL=Lmod
fi
eb --version
eb --show-config
# gather some useful info on test system
eb --show-system-info
# actively break "import setuptools" and "import pkg_resources",
# since EasyBuild should not have a runtime requirement on setuptools
echo 'raise ImportError("setuptools should no longer be relied on")' > $PREFIX/setuptools.py
echo 'raise ImportError("setuptools should no longer be relied on")' > $PREFIX/pkg_resources.py
export PYTHONPATH=$PREFIX:$PYTHONPATH
# run test suite
python -O -m test.easyblocks.suite
# check output of --list-easyblocks
eb --list-easyblocks > eb_list_easyblocks.out
grep 'ConfigureMake\>' eb_list_easyblocks.out
grep EB_GCC eb_list_easyblocks.out