-
Notifications
You must be signed in to change notification settings - Fork 706
195 lines (164 loc) · 7.66 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: easyconfigs 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:
test-suite:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [3.6]
modules_tool: [Lmod-7.8.22, Lmod-8.6.8]
module_syntax: [Lua, Tcl]
# exclude some configurations: only test Tcl module syntax with Lmod 8.x and Python 3.6
exclude:
- modules_tool: Lmod-7.8.22
module_syntax: Tcl
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Required for git merge-base to work
- name: Cache source files in /tmp/sources
id: cache-sources
uses: actions/cache@v2
with:
path: /tmp/sources
key: eb-sourcepath
- name: set up Python
uses: actions/setup-python@v4
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
# required for test_dep_graph
pip install pep8 python-graph-core python-graph-dot
- name: install EasyBuild framework
run: |
cd $HOME
# first determine which branch of easybuild-framework repo to install
BRANCH=develop
if [ "x$GITHUB_BASE_REF" = 'xmain' ]; then BRANCH=main; fi
if [ "x$GITHUB_BASE_REF" = 'x4.x' ]; then BRANCH=4.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
git clone -b $BRANCH --depth 10 --single-branch https://github.com/easybuilders/easybuild-easyblocks.git
cd easybuild-easyblocks; git log -n 1; cd -
pip install $PWD/easybuild-easyblocks
- 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: run test suite
env:
EB_VERBOSE: 1
EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
run: |
# pull in target so we can diff against it to obtain list of touched files
if [ "x$GITHUB_BASE_REF" != 'xmain' ]; then git fetch -v origin ${GITHUB_BASE_REF}:${GITHUB_BASE_REF}; fi
# 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
WORKDIR=$GITHUB_WORKSPACE/easybuild-easyconfigs
export PATH=$WORKDIR/test/bin:$(cat $HOME/path)
export PYTHONPATH=$WORKDIR
# 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
# run test suite
# if tests failed, print error message that is picked up by boegelbot to determine end of test output
python -O -m test.easyconfigs.suite || (echo "ERROR: Not all tests were successful" && exit 1)
unset PYTHONPATH
# install easyconfigs via distribution package
python setup.py sdist > /dev/null
ls dist
pip install dist/easybuild-easyconfigs*tar.gz > /dev/null
# robot-paths value should not be empty, but have an entry that includes easybuild/easyconfigs subdir
echo "eb --show-config"
eb --show-config | tee eb_show_config.out
grep "^robot-paths .*/easybuild/easyconfigs" eb_show_config.out
# check whether some specific easyconfig files are found
echo "eb --search 'TensorFlow-1.14.*.eb'"
eb --search 'TensorFlow-1.14.*.eb' | tee eb_search_TF.out
grep '/TensorFlow-1.14.0-foss-2019a-Python-3.7.2.eb$' eb_search_TF.out
echo "eb --search '^foss-2019b.eb'"
eb --search '^foss-2019b.eb' | tee eb_search_foss.out
grep '/foss-2019b.eb$' eb_search_foss.out
# make sure CVS easyconfigs are included in installation (cfr. issue #10325)
echo "Searching for CVS easyconfigs..."
eb --search '^CVS-' | grep '/CVS-'
# try installing M4 with system toolchain (requires ConfigureMake easyblock + easyconfig)
# use /tmp/sources because that has cached downloads (see cache step above)
eb --prefix /tmp/$USER/$GITHUB_SHA --sourcepath /tmp/sources M4-1.4.18.eb
test-sdist:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [3.6]
steps:
- uses: actions/checkout@v2
- name: set up Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python}}
- name: Create source distribution
run: python setup.py sdist
- name: Inspect files included in source distribution
working-directory: dist
run: |
tar xfz easybuild-easyconfigs*tar.gz
cd easybuild-easyconfigs-*/
# .git folder should not be there in source tarball
dot_git_files=$(find . -name .git)
if [ -n "$dot_git_files" ]; then
echo "Found .git folders in source tarball: $dot_git_files" && false
else
echo "No .git folders found in source tarball: OK"
fi
# CVS easyconfigs must be included in source tarball,
# see https://github.com/easybuilders/easybuild-easyconfigs/issues/10325
cvs_easyconfigs=$(find . -name 'CVS-*.eb')
if [ -z "$cvs_easyconfigs" ]; then
echo "CVS easyconfigs not found" && false
else
echo "Found CVS easyconfigs: $cvs_easyconfigs"
fi