Skip to content

Commit

Permalink
Merge pull request #4370 from easybuilders/4.8.x
Browse files Browse the repository at this point in the history
release EasyBuild v4.8.2
  • Loading branch information
boegel authored Oct 29, 2023
2 parents 14c273a + c93633c commit e149177
Show file tree
Hide file tree
Showing 20 changed files with 290 additions and 85 deletions.
82 changes: 33 additions & 49 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,25 @@ jobs:
- ${{needs.setup.outputs.modulesTcl}}
- ${{needs.setup.outputs.modules3}}
- ${{needs.setup.outputs.modules4}}
module_syntax: [Lua, Tcl]
lc_all: [""]
# don't test with Lua module syntax (only supported in Lmod)
exclude:
- modules_tool: ${{needs.setup.outputs.modulesTcl}}
module_syntax: Lua
- modules_tool: ${{needs.setup.outputs.modules3}}
module_syntax: Lua
- modules_tool: ${{needs.setup.outputs.modules4}}
module_syntax: Lua
include:
# Test different Python 3 versions with Lmod 8.x (with both Lua and Tcl module syntax)
# Test different Python 3 versions with Lmod 8.x
- python: 3.5
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: 3.7
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: 3.8
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: 3.8
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Tcl
- python: 3.9
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: '3.10'
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: '3.11'
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: '3.11'
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Tcl
# There may be encoding errors in Python 3 which are hidden when an UTF-8 encoding is set
# Hence run the tests (again) with LC_ALL=C and Python 3.6 (or any < 3.7)
- python: 3.6
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
lc_all: C
fail-fast: false
steps:
Expand Down Expand Up @@ -125,16 +103,11 @@ jobs:
# and are only run after the PR gets merged
GITHUB_TOKEN: ${{secrets.CI_UNIT_TESTS_GITHUB_TOKEN}}
run: |
# don't install GitHub token when testing with Lmod 7.x or non-Lmod module tools,
# and only when testing with Lua as module syntax,
# to avoid hitting GitHub rate limit;
# don't install GitHub token when testing with Lmod 7.x or non-Lmod module tools, to avoid hitting GitHub rate limit;
# tests that require a GitHub token are skipped automatically when no GitHub token is available
if [[ ! "${{matrix.modules_tool}}" =~ 'Lmod-7' ]] && [[ ! "${{matrix.modules_tool}}" =~ 'modules-' ]] && [[ "${{matrix.module_syntax}}" == 'Lua' ]]; then
if [[ ! "${{matrix.modules_tool}}" =~ 'Lmod-7' ]] && [[ ! "${{matrix.modules_tool}}" =~ 'modules-' ]]; then
if [ ! -z $GITHUB_TOKEN ]; then
if [ "x${{matrix.python}}" == 'x2.6' ];
then SET_KEYRING="keyring.set_keyring(keyring.backends.file.PlaintextKeyring())";
else SET_KEYRING="import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())";
fi;
SET_KEYRING="import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())";
python -c "import keyring; $SET_KEYRING; keyring.set_password('github_token', 'easybuild_test', '$GITHUB_TOKEN')";
fi
echo "GitHub token installed!"
Expand Down Expand Up @@ -172,8 +145,6 @@ jobs:
- name: run test suite
env:
EB_VERBOSE: 1
EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
TEST_EASYBUILD_MODULE_SYNTAX: ${{matrix.module_syntax}}
LC_ALL: ${{matrix.lc_all}}
run: |
# run tests *outside* of checked out easybuild-framework directory,
Expand All @@ -198,19 +169,32 @@ jobs:
else
export EASYBUILD_MODULES_TOOL=Lmod
fi
export TEST_EASYBUILD_MODULES_TOOL=$EASYBUILD_MODULES_TOOL
eb --show-config
# gather some useful info on test system
eb --show-system-info
# check GitHub configuration
eb --check-github --github-user=easybuild_test
# create file owned by root but writable by anyone (used by test_copy_file)
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
# run test suite
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
# try and make sure output of running tests is clean (no printed messages/warnings)
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"
# '|| true' is needed to avoid that Travis stops the job on non-zero exit of grep (i.e. when there are no matches)
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
export TEST_EASYBUILD_MODULES_TOOL=${EASYBUILD_MODULES_TOOL}
# Run tests with LUA and Tcl module syntax (where supported)
for module_syntax in Lua Tcl; do
# Only Lmod supports Lua
if [[ "${module_syntax}" == "Lua" ]] && [[ "${EASYBUILD_MODULES_TOOL}" != "Lmod" ]]; then
echo "Not testing with '${module_syntax}' as module syntax with '${EASYBUILD_MODULES_TOOL}' as modules tool"
continue
fi
printf '\n\n=====================> Using $module_syntax module syntax <=====================\n\n'
export EASYBUILD_MODULE_SYNTAX="${module_syntax}"
export TEST_EASYBUILD_MODULE_SYNTAX="${EASYBUILD_MODULE_SYNTAX}"
eb --show-config
# gather some useful info on test system
eb --show-system-info
# check GitHub configuration
eb --check-github --github-user=easybuild_test
# create file owned by root but writable by anyone (used by test_copy_file)
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
# run test suite
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
# try and make sure output of running tests is clean (no printed messages/warnings)
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"
# '|| true' is needed to avoid that GitHub Actions stops the job on non-zero exit of grep (i.e. when there are no matches)
PRINTED_MSG=$(egrep -v "${IGNORE_PATTERNS}" test_framework_suite.log | grep '\.\n*[A-Za-z]' || true)
test "x$PRINTED_MSG" = "x" || (echo "ERROR: Found printed messages in output of test suite" && echo "${PRINTED_MSG}" && exit 1)
done
81 changes: 81 additions & 0 deletions .github/workflows/unit_tests_python2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: EasyBuild framework unit tests (python2)
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_python2:
runs-on: ubuntu-20.04
container:
# CentOS 7.9 container that already includes Lmod & co,
# see https://github.com/easybuilders/easybuild-containers
image: ghcr.io/easybuilders/centos-7.9-amd64
steps:
- uses: actions/checkout@v3

- name: install Python packages
run: |
# Python packages
python2 -V
python2 -m pip --version
python2 -m pip install --upgrade pip
python2 -m pip --version
# strip out GC3Pie since installation with ancient setuptools (0.9.8) fails
sed -i '/GC3Pie/d' requirements.txt
python2 -m pip install -r requirements.txt
# git config is required to make actual git commits (cfr. tests for GitRepository)
sudo -u easybuild git config --global user.name "GitHub Actions"
sudo -u easybuild git config --global user.email "[email protected]"
sudo -u easybuild git config --get-regexp 'user.*'
- name: install GitHub token (if available)
env:
# token (owned by @boegelbot) with gist permissions (required for some of the tests for GitHub integration);
# this token is not available in pull requests, so tests that require it are skipped in PRs,
# and are only run after the PR gets merged
GITHUB_TOKEN: ${{secrets.CI_UNIT_TESTS_GITHUB_TOKEN}}
run: |
# tests that require a GitHub token are skipped automatically when no GitHub token is available
if [ ! -z $GITHUB_TOKEN ]; then
sudo -u easybuild python2 -c "import keyring; import keyrings.alt.file; keyring.set_keyring(keyrings.alt.file.PlaintextKeyring()); keyring.set_password('github_token', 'easybuild_test', '$GITHUB_TOKEN')";
echo "GitHub token installed!"
else
echo "Installation of GitHub token skipped!"
fi
- name: install sources
run: |
# install from source distribution tarball, to test release as published on PyPI
python2 setup.py sdist
ls dist
export PREFIX=/tmp/$USER/$GITHUB_SHA
python2 -m pip install --prefix $PREFIX dist/easybuild-framework*tar.gz
- name: run test suite
run: |
# run tests *outside* of checked out easybuild-framework directory,
# to ensure we're testing installed version (see previous step)
cd $HOME
# make sure 'eb' is available via $PATH, and that $PYTHONPATH is set (some tests expect that)
export PREFIX=/tmp/$USER/$GITHUB_SHA
ENV_CMDS="export PATH=$PREFIX/bin:$PATH; export PYTHONPATH=$PREFIX/lib/python2.7/site-packages:$PYTHONPATH"
ENV_CMDS="${ENV_CMDS}; export EB_VERBOSE=1; export EB_PYTHON=python2; export TEST_EASYBUILD_SILENCE_DEPRECATION_WARNINGS=python2"
# run EasyBuild command via (non-root) easybuild user + login shell
sudo -u easybuild bash -l -c "${ENV_CMDS}; module --version; eb --version"
# show active EasyBuild configuration
sudo -u easybuild bash -l -c "${ENV_CMDS}; eb --show-config"
# gather some useful info on test system
sudo -u easybuild bash -l -c "${ENV_CMDS}; eb --show-system-info"
# check GitHub configuration
sudo -u easybuild bash -l -c "${ENV_CMDS}; eb --check-github --github-user=easybuild_test"
# create file owned by root but writable by anyone (used by test_copy_file)
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
# run test suite (via easybuild user + login shell)
sudo -u easybuild bash -l -c "${ENV_CMDS}; python2 -O -m test.framework.suite"
19 changes: 19 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ For more detailed information, please see the git log.
These release notes can also be consulted at https://easybuild.readthedocs.io/en/latest/Release_notes.html.


v4.8.2 (29 October 2023)
------------------------

update/bugfix release

- various enhancements, including:
- add support for `%(sysroot)s` template value (#4359)
- add `dependency_names` method to `EasyConfig` class to get set of names of (direct) dependencies (#4360)
- various bug fixes, including:
- add CI workflow to run unit tests with Python 2 (again) (#4333)
- fix typo in help message for `--silence-hook-trigger` (#4343)
- include major version (`*majver`) templates in auto-generated documentation (#4347)
- reset `tempfile.tempdir` to `None` to avoid that tmpdir path gets progressively deeper with each easystack item (#4350)
- fix `findPythonDeps.py` script when called with an (absolute or relative) path to an easyconfig instead of a filename (#4365)
- fix broken test for `reasons_for_closing`, which fails because commit status of easyconfigs PR is no longer available (#4366)
- other changes:
- reduce number of CI jobs by testing for Lua and Tcl module syntax in a single CI job (#4192)


v4.8.1 (11 September 2023)
--------------------------

Expand Down
9 changes: 9 additions & 0 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,15 @@ def dependencies(self, build_only=False):

return retained_deps

def dependency_names(self, build_only=False):
"""
Return a set of names of all (direct) dependencies after filtering.
Iterable builddependencies are flattened when not iterating.
:param build_only: only return build dependencies, discard others
"""
return {dep['name'] for dep in self.dependencies(build_only=build_only) if dep['name']}

def builddependencies(self):
"""
Return a flat list of the parsed build dependencies
Expand Down
10 changes: 8 additions & 2 deletions easybuild/framework/easyconfig/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
('installdir', "Installation directory"),
('start_dir', "Directory in which the build process begins"),
]
# software names for which to define <pref>ver and <pref>shortver templates
# software names for which to define <pref>ver, <pref>majver and <pref>shortver templates
TEMPLATE_SOFTWARE_VERSIONS = [
# software name, prefix for *ver and *shortver
# software name, prefix for *ver, *majver and *shortver
('CUDA', 'cuda'),
('CUDAcore', 'cuda'),
('Java', 'java'),
Expand All @@ -90,6 +90,8 @@
# template values which are only generated dynamically
TEMPLATE_NAMES_DYNAMIC = [
('arch', "System architecture (e.g. x86_64, aarch64, ppc64le, ...)"),
('sysroot', "Location root directory of system, prefix for standard paths like /usr/lib and /usr/include"
"as specify by the --sysroot configuration option"),
('mpi_cmd_prefix', "Prefix command for running MPI programs (with default number of ranks)"),
('cuda_compute_capabilities', "Comma-separated list of CUDA compute capabilities, as specified via "
"--cuda-compute-capabilities configuration option or via cuda_compute_capabilities easyconfig parameter"),
Expand Down Expand Up @@ -201,6 +203,9 @@ def template_constant_dict(config, ignore=None, skip_lower=None, toolchain=None)
# set 'arch' for system architecture based on 'machine' (4th) element of platform.uname() return value
template_values['arch'] = platform.uname()[4]

# set 'sysroot' template based on 'sysroot' configuration option, using empty string as fallback
template_values['sysroot'] = build_option('sysroot') or ''

# step 1: add TEMPLATE_NAMES_EASYCONFIG
for name in TEMPLATE_NAMES_EASYCONFIG:
if name in ignore:
Expand Down Expand Up @@ -427,6 +432,7 @@ def template_documentation():
# step 2: add *ver/*shortver templates for software listed in TEMPLATE_SOFTWARE_VERSIONS
doc.append("Template names/values for (short) software versions")
for name, pref in TEMPLATE_SOFTWARE_VERSIONS:
doc.append("%s%%(%smajver)s: major version for %s" % (indent_l1, pref, name))
doc.append("%s%%(%sshortver)s: short version for %s (<major>.<minor>)" % (indent_l1, pref, name))
doc.append("%s%%(%sver)s: full version for %s" % (indent_l1, pref, name))

Expand Down
4 changes: 3 additions & 1 deletion easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import os
import stat
import sys
import tempfile
import traceback

# IMPORTANT this has to be the first easybuild import as it customises the logging
Expand Down Expand Up @@ -254,8 +255,9 @@ def process_easystack(easystack_path, args, logfile, testing, init_session_state
easyconfig._easyconfigs_cache.clear()
easyconfig._easyconfig_files_cache.clear()

# restore environment
# restore environment and reset tempdir (to avoid tmpdir path getting progressively longer)
restore_env(init_env)
tempfile.tempdir = None

# If EasyConfig specific arguments were supplied in EasyStack file
# merge arguments with original command line args
Expand Down
13 changes: 9 additions & 4 deletions easybuild/scripts/findPythonDeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ def run_cmd(arguments, action_desc, capture_stderr=True, **kwargs):
extra_args['universal_newlines'] = True
stderr = subprocess.STDOUT if capture_stderr else subprocess.PIPE
p = subprocess.Popen(arguments, stdout=subprocess.PIPE, stderr=stderr, **extra_args)
out, _ = p.communicate()
out, err = p.communicate()
if p.returncode != 0:
raise RuntimeError('Failed to %s: %s' % (action_desc, out))
if err:
err = "\nSTDERR:\n" + err
raise RuntimeError('Failed to %s: %s%s' % (action_desc, out, err))
return out


Expand Down Expand Up @@ -171,20 +173,23 @@ def print_deps(package, verbose):
capture_stderr=False,
action_desc='Get missing dependencies'
)
excluded_dep = '(%s)' % os.path.basename(args.ec)
missing_deps = [dep for dep in missing_dep_out.split('\n')
if dep.startswith('*') and '(%s)' % args.ec not in dep
if dep.startswith('*') and excluded_dep not in dep
]
if missing_deps:
print('You need to install all modules on which %s depends first!' % args.ec)
print('\n\t'.join(['Missing:'] + missing_deps))
sys.exit(1)

# If the --ec argument is a (relative) existing path make it absolute so we can find it after the chdir
ec_arg = os.path.abspath(args.ec) if os.path.exists(args.ec) else args.ec
with temporary_directory() as tmp_dir:
old_dir = os.getcwd()
os.chdir(tmp_dir)
if args.verbose:
print('Running EasyBuild to get build environment')
run_cmd(['eb', args.ec, '--dump-env', '--force'], action_desc='Dump build environment')
run_cmd(['eb', ec_arg, '--dump-env', '--force'], action_desc='Dump build environment')
os.chdir(old_dir)

cmd = "source %s/*.env && python %s '%s'" % (tmp_dir, sys.argv[0], args.package)
Expand Down
2 changes: 1 addition & 1 deletion easybuild/toolchains/compiler/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Gcc(Compiler):

COMPILER_FAMILY = TC_CONSTANT_GCC
COMPILER_UNIQUE_OPTS = {
'loop': (False, "Automatic loop parallellisation"),
'loop': (False, "Automatic loop parallelisation"),
'f2c': (False, "Generate code compatible with f2c and f77"),
'lto': (False, "Enable Link Time Optimization"),
}
Expand Down
Loading

0 comments on commit e149177

Please sign in to comment.