Skip to content

Commit d450a80

Browse files
authored
Merge pull request #4192 from Flamefire/gha_ci_reduce
reduce number of CI jobs by testing for Lua and Tcl module syntax in a single CI job
2 parents dfe3b3f + e4b2ac3 commit d450a80

File tree

1 file changed

+33
-49
lines changed

1 file changed

+33
-49
lines changed

.github/workflows/unit_tests.yml

Lines changed: 33 additions & 49 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:
@@ -125,16 +103,11 @@ jobs:
125103
# and are only run after the PR gets merged
126104
GITHUB_TOKEN: ${{secrets.CI_UNIT_TESTS_GITHUB_TOKEN}}
127105
run: |
128-
# don't install GitHub token when testing with Lmod 7.x or non-Lmod module tools,
129-
# and only when testing with Lua as module syntax,
130-
# to avoid hitting GitHub rate limit;
106+
# don't install GitHub token when testing with Lmod 7.x or non-Lmod module tools, to avoid hitting GitHub rate limit;
131107
# 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
108+
if [[ ! "${{matrix.modules_tool}}" =~ 'Lmod-7' ]] && [[ ! "${{matrix.modules_tool}}" =~ 'modules-' ]]; then
133109
if [ ! -z $GITHUB_TOKEN ]; then
134-
if [ "x${{matrix.python}}" == 'x2.6' ];
135-
then SET_KEYRING="keyring.set_keyring(keyring.backends.file.PlaintextKeyring())";
136-
else SET_KEYRING="import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())";
137-
fi;
110+
SET_KEYRING="import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())";
138111
python -c "import keyring; $SET_KEYRING; keyring.set_password('github_token', 'easybuild_test', '$GITHUB_TOKEN')";
139112
fi
140113
echo "GitHub token installed!"
@@ -172,8 +145,6 @@ jobs:
172145
- name: run test suite
173146
env:
174147
EB_VERBOSE: 1
175-
EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
176-
TEST_EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
177148
LC_ALL: ${{matrix.lc_all}}
178149
run: |
179150
# run tests *outside* of checked out easybuild-framework directory,
@@ -198,19 +169,32 @@ jobs:
198169
else
199170
export EASYBUILD_MODULES_TOOL=Lmod
200171
fi
201-
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)
172+
export TEST_EASYBUILD_MODULES_TOOL=${EASYBUILD_MODULES_TOOL}
173+
174+
# Run tests with LUA and Tcl module syntax (where supported)
175+
for module_syntax in Lua Tcl; do
176+
# Only Lmod supports Lua
177+
if [[ "${module_syntax}" == "Lua" ]] && [[ "${EASYBUILD_MODULES_TOOL}" != "Lmod" ]]; then
178+
echo "Not testing with '${module_syntax}' as module syntax with '${EASYBUILD_MODULES_TOOL}' as modules tool"
179+
continue
180+
fi
181+
printf '\n\n=====================> Using $module_syntax module syntax <=====================\n\n'
182+
export EASYBUILD_MODULE_SYNTAX="${module_syntax}"
183+
export TEST_EASYBUILD_MODULE_SYNTAX="${EASYBUILD_MODULE_SYNTAX}"
184+
185+
eb --show-config
186+
# gather some useful info on test system
187+
eb --show-system-info
188+
# check GitHub configuration
189+
eb --check-github --github-user=easybuild_test
190+
# create file owned by root but writable by anyone (used by test_copy_file)
191+
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
192+
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
193+
# run test suite
194+
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
195+
# try and make sure output of running tests is clean (no printed messages/warnings)
196+
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"
197+
# '|| true' is needed to avoid that GitHub Actions stops the job on non-zero exit of grep (i.e. when there are no matches)
198+
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
199+
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
200+
done

0 commit comments

Comments
 (0)