Skip to content

[5.0x] run pip check only once for PythonBundle #5074

[5.0x] run pip check only once for PythonBundle

[5.0x] run pip check only once for PythonBundle #5074

Workflow file for this run

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', '3.12']
modules_tool: [Lmod-8.1.14, modules-tcl-1.147, modules-3.2.10, modules-4.5.3]
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.5.3
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-tcl-1.147
python: '3.12'
- 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-3.2.10
python: '3.12'
- modules_tool: modules-4.5.3
python: 3.7
- modules_tool: modules-4.5.3
python: 3.8
- modules_tool: modules-4.5.3
python: 3.9
- modules_tool: modules-4.5.3
python: '3.10'
- modules_tool: modules-4.5.3
python: '3.11'
- modules_tool: modules-4.5.3
python: '3.12'
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
# Python packages
pip --version
pip install --upgrade pip
pip --version
if ! python -c "import distutils" 2> /dev/null; then
# we need setuptools for distutils in Python 3.12+, needed for python setup.py sdist
pip install --upgrade setuptools
fi
- 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