|
| 1 | +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions |
| 2 | +name: Tests for the 'eb' command |
| 3 | +on: [push, pull_request] |
| 4 | +jobs: |
| 5 | + test-eb: |
| 6 | + runs-on: ubuntu-18.04 |
| 7 | + strategy: |
| 8 | + matrix: |
| 9 | + python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] |
| 10 | + fail-fast: false |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + |
| 14 | + - name: set up Python |
| 15 | + uses: actions/setup-python@v2 |
| 16 | + with: |
| 17 | + python-version: ${{matrix.python}} |
| 18 | + architecture: x64 |
| 19 | + |
| 20 | + - name: install OS & Python packages |
| 21 | + run: | |
| 22 | + # check Python version |
| 23 | + python -V |
| 24 | + # update to latest pip, check version |
| 25 | + pip install --upgrade pip |
| 26 | + pip --version |
| 27 | + # install packages required for modules tool |
| 28 | + sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev |
| 29 | + # fix for lua-posix packaging issue, see https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082 |
| 30 | + # needed for Ubuntu 18.04, but not for Ubuntu 20.04, so skipping symlinking if posix.so already exists |
| 31 | + if [ ! -e /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so ] ; then |
| 32 | + 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 |
| 33 | + fi |
| 34 | +
|
| 35 | + - name: install modules tool |
| 36 | + run: | |
| 37 | + # avoid downloading modules tool sources into easybuild-framework dir |
| 38 | + cd $HOME |
| 39 | + export INSTALL_DEP=$GITHUB_WORKSPACE/easybuild/scripts/install_eb_dep.sh |
| 40 | + # install Lmod |
| 41 | + source $INSTALL_DEP Lmod-8.4.26 $HOME |
| 42 | + # changes in environment are not passed to other steps, so need to create files... |
| 43 | + echo $MOD_INIT > mod_init |
| 44 | + echo $PATH > path |
| 45 | + if [ ! -z $MODULESHOME ]; then echo $MODULESHOME > moduleshome; fi |
| 46 | +
|
| 47 | + - name: install EasyBuild framework |
| 48 | + run: | |
| 49 | + # install from source distribution tarball, to test release as published on PyPI |
| 50 | + python setup.py sdist |
| 51 | + ls dist |
| 52 | + export PREFIX=/tmp/$USER/$GITHUB_SHA |
| 53 | + pip install --prefix $PREFIX dist/easybuild-framework*tar.gz |
| 54 | +
|
| 55 | + - name: run tests for 'eb' command |
| 56 | + env: |
| 57 | + EB_VERBOSE: 1 |
| 58 | + run: | |
| 59 | + # run tests *outside* of checked out easybuild-framework directory, |
| 60 | + # to ensure we're testing installed version (see previous step) |
| 61 | + cd $HOME |
| 62 | + # initialize environment for modules tool |
| 63 | + if [ -f $HOME/moduleshome ]; then export MODULESHOME=$(cat $HOME/moduleshome); fi |
| 64 | + source $(cat $HOME/mod_init); type module |
| 65 | + # make sure 'eb' is available via $PATH, and that $PYTHONPATH is set (some tests expect that); |
| 66 | + # also pick up changes to $PATH set by sourcing $MOD_INIT |
| 67 | + export PREFIX=/tmp/$USER/$GITHUB_SHA |
| 68 | + export PATH=$PREFIX/bin:$(cat $HOME/path) |
| 69 | + export PYTHONPATH=$PREFIX/lib/python${{matrix.python}}/site-packages:$PYTHONPATH |
| 70 | + # run --version, capture (verbose) output |
| 71 | + eb --version | tee eb_version.out 2>&1 |
| 72 | + # determine active Python version |
| 73 | + pymajver=$(python -c 'import sys; print(sys.version_info[0])') |
| 74 | + pymajminver=$(python -c 'import sys; print(".".join(str(x) for x in sys.version_info[:2]))') |
| 75 | + # check patterns in verbose output |
| 76 | + for pattern in "^>> Considering .python.\.\.\." "^>> .python. version: ${pymajminver}\.[0-9]\+, which matches Python ${pymajver} version requirement" "^>> 'python' is able to import 'easybuild.main', so retaining it" "^>> Selected Python command: python \(.*/bin/python\)" "^This is EasyBuild 4\.[0-9.]\+"; do |
| 77 | + echo "Looking for pattern \"${pattern}\" in eb_version.out..." |
| 78 | + grep "$pattern" eb_version.out |
| 79 | + done |
| 80 | + # also check when specifying Python command via $EB_PYTHON |
| 81 | + for eb_python in "python${pymajver}" "python${pymajminver}"; do |
| 82 | + export EB_PYTHON="${eb_python}" |
| 83 | + eb --version | tee eb_version.out 2>&1 |
| 84 | + for pattern in "^>> Considering .${eb_python}.\.\.\." "^>> .${eb_python}. version: ${pymajminver}\.[0-9]\+, which matches Python ${pymajver} version requirement" "^>> '${eb_python}' is able to import 'easybuild.main', so retaining it" "^>> Selected Python command: ${eb_python} \(.*/bin/${eb_python}\)" "^This is EasyBuild 4\.[0-9.]\+"; do |
| 85 | + echo "Looking for pattern \"${pattern}\" in eb_version.out..." |
| 86 | + grep "$pattern" eb_version.out |
| 87 | + done |
| 88 | + done |
0 commit comments