Skip to content

Commit 3da393a

Browse files
committed
reduce number of CI jobs
We run into rate limits installing the dependencies. We can reduce the number of CI jobs to almost half by running the tests in a loop for each supported module syntax.
1 parent fca8b93 commit 3da393a

File tree

1 file changed

+29
-41
lines changed

1 file changed

+29
-41
lines changed

.github/workflows/unit_tests.yml

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,47 +34,25 @@ jobs:
3434
- ${{needs.setup.outputs.modulesTcl}}
3535
- ${{needs.setup.outputs.modules3}}
3636
- ${{needs.setup.outputs.modules4}}
37-
module_syntax: [Lua, Tcl]
3837
lc_all: [""]
39-
# don't test with Lua module syntax (only supported in Lmod)
40-
exclude:
41-
- modules_tool: ${{needs.setup.outputs.modulesTcl}}
42-
module_syntax: Lua
43-
- modules_tool: ${{needs.setup.outputs.modules3}}
44-
module_syntax: Lua
45-
- modules_tool: ${{needs.setup.outputs.modules4}}
46-
module_syntax: Lua
4738
include:
48-
# Test different Python 3 versions with Lmod 8.x (with both Lua and Tcl module syntax)
39+
# Test different Python 3 versions with Lmod 8.x
4940
- python: 3.5
5041
modules_tool: ${{needs.setup.outputs.lmod8}}
51-
module_syntax: Lua
5242
- python: 3.7
5343
modules_tool: ${{needs.setup.outputs.lmod8}}
54-
module_syntax: Lua
5544
- python: 3.8
5645
modules_tool: ${{needs.setup.outputs.lmod8}}
57-
module_syntax: Lua
58-
- python: 3.8
59-
modules_tool: ${{needs.setup.outputs.lmod8}}
60-
module_syntax: Tcl
6146
- python: 3.9
6247
modules_tool: ${{needs.setup.outputs.lmod8}}
63-
module_syntax: Lua
6448
- python: '3.10'
6549
modules_tool: ${{needs.setup.outputs.lmod8}}
66-
module_syntax: Lua
67-
- python: '3.11'
68-
modules_tool: ${{needs.setup.outputs.lmod8}}
69-
module_syntax: Lua
7050
- python: '3.11'
7151
modules_tool: ${{needs.setup.outputs.lmod8}}
72-
module_syntax: Tcl
7352
# There may be encoding errors in Python 3 which are hidden when an UTF-8 encoding is set
7453
# Hence run the tests (again) with LC_ALL=C and Python 3.6 (or any < 3.7)
7554
- python: 3.6
7655
modules_tool: ${{needs.setup.outputs.lmod8}}
77-
module_syntax: Lua
7856
lc_all: C
7957
fail-fast: false
8058
steps:
@@ -129,7 +107,7 @@ jobs:
129107
# and only when testing with Lua as module syntax,
130108
# to avoid hitting GitHub rate limit;
131109
# tests that require a GitHub token are skipped automatically when no GitHub token is available
132-
if [[ ! "${{matrix.modules_tool}}" =~ 'Lmod-7' ]] && [[ ! "${{matrix.modules_tool}}" =~ 'modules-' ]] && [[ "${{matrix.module_syntax}}" == 'Lua' ]]; then
110+
if [[ ! "${{matrix.modules_tool}}" =~ 'Lmod-7' ]] && [[ ! "${{matrix.modules_tool}}" =~ 'modules-' ]]; then
133111
if [ ! -z $GITHUB_TOKEN ]; then
134112
if [ "x${{matrix.python}}" == 'x2.6' ];
135113
then SET_KEYRING="keyring.set_keyring(keyring.backends.file.PlaintextKeyring())";
@@ -172,8 +150,6 @@ jobs:
172150
- name: run test suite
173151
env:
174152
EB_VERBOSE: 1
175-
EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
176-
TEST_EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
177153
LC_ALL: ${{matrix.lc_all}}
178154
run: |
179155
# run tests *outside* of checked out easybuild-framework directory,
@@ -199,18 +175,30 @@ jobs:
199175
export EASYBUILD_MODULES_TOOL=Lmod
200176
fi
201177
export TEST_EASYBUILD_MODULES_TOOL=$EASYBUILD_MODULES_TOOL
202-
eb --show-config
203-
# gather some useful info on test system
204-
eb --show-system-info
205-
# check GitHub configuration
206-
eb --check-github --github-user=easybuild_test
207-
# create file owned by root but writable by anyone (used by test_copy_file)
208-
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
209-
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
210-
# run test suite
211-
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
212-
# try and make sure output of running tests is clean (no printed messages/warnings)
213-
IGNORE_PATTERNS="no GitHub token available|skipping SvnRepository test|requires Lmod as modules tool|stty: 'standard input': Inappropriate ioctl for device|CryptographyDeprecationWarning: Python 3.[56]|from cryptography.* import |CryptographyDeprecationWarning: Python 2|Blowfish|GC3Pie not available, skipping test"
214-
# '|| true' is needed to avoid that Travis stops the job on non-zero exit of grep (i.e. when there are no matches)
215-
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
216-
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
178+
179+
# Run tests with LUA and Tcl module syntax (where supported)
180+
for module_syntax in Lua Tcl; do
181+
# Only Lmod supports Lua
182+
if [[ "$module_syntax" == "Lua" ]] && [[ "$EASYBUILD_MODULES_TOOL" != "Lmod" ]]; then
183+
continue
184+
fi
185+
printf '\n\n=====================> Using $module_syntax module syntax <=====================\n\n'
186+
export EASYBUILD_MODULE_SYNTAX="$module_syntax"
187+
export TEST_EASYBUILD_MODULE_SYNTAX="$EASYBUILD_MODULE_SYNTAX"
188+
189+
eb --show-config
190+
# gather some useful info on test system
191+
eb --show-system-info
192+
# check GitHub configuration
193+
eb --check-github --github-user=easybuild_test
194+
# create file owned by root but writable by anyone (used by test_copy_file)
195+
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
196+
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
197+
# run test suite
198+
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
199+
# try and make sure output of running tests is clean (no printed messages/warnings)
200+
IGNORE_PATTERNS="no GitHub token available|skipping SvnRepository test|requires Lmod as modules tool|stty: 'standard input': Inappropriate ioctl for device|CryptographyDeprecationWarning: Python 3.[56]|from cryptography.* import |CryptographyDeprecationWarning: Python 2|Blowfish|GC3Pie not available, skipping test"
201+
# '|| true' is needed to avoid that Travis stops the job on non-zero exit of grep (i.e. when there are no matches)
202+
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
203+
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
204+
done

0 commit comments

Comments
 (0)