|
| 1 | +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions |
| 2 | +name: test EasyBuild bootstrap script |
| 3 | +on: [push, pull_request] |
| 4 | +jobs: |
| 5 | + setup: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + outputs: |
| 8 | + lmod7: Lmod-7.8.22 |
| 9 | + lmod8: Lmod-8.4.27 |
| 10 | + modulesTcl: modules-tcl-1.147 |
| 11 | + modules3: modules-3.2.10 |
| 12 | + modules4: modules-4.1.4 |
| 13 | + steps: |
| 14 | + - run: "true" |
| 15 | + build: |
| 16 | + needs: setup |
| 17 | + runs-on: ubuntu-18.04 |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python: [2.7, 3.6, 3.7, 3.8, 3.9] |
| 21 | + modules_tool: |
| 22 | + # use variables defined by 'setup' job above, see also |
| 23 | + # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context |
| 24 | + - ${{needs.setup.outputs.lmod7}} |
| 25 | + - ${{needs.setup.outputs.lmod8}} |
| 26 | + module_syntax: [Lua] |
| 27 | + lc_all: [""] |
| 28 | + include: |
| 29 | + # also test with module tools other than Lmod (only Tcl syntax) |
| 30 | + - modules_tool: ${{needs.setup.outputs.modulesTcl}} |
| 31 | + module_syntax: Tcl |
| 32 | + python: 2.7 |
| 33 | + - modules_tool: ${{needs.setup.outputs.modulesTcl}} |
| 34 | + module_syntax: Tcl |
| 35 | + python: 3.6 |
| 36 | + - modules_tool: ${{needs.setup.outputs.modules3}} |
| 37 | + module_syntax: Tcl |
| 38 | + python: 2.7 |
| 39 | + - modules_tool: ${{needs.setup.outputs.modules3}} |
| 40 | + module_syntax: Tcl |
| 41 | + python: 3.6 |
| 42 | + - modules_tool: ${{needs.setup.outputs.modules4}} |
| 43 | + module_syntax: Tcl |
| 44 | + python: 2.7 |
| 45 | + - modules_tool: ${{needs.setup.outputs.modules4}} |
| 46 | + module_syntax: Tcl |
| 47 | + python: 3.6 |
| 48 | + # There may be encoding errors in Python 3 which are hidden when an UTF-8 encoding is set |
| 49 | + # Hence run the tests (again) with LC_ALL=C and Python 3.6 (or any < 3.7) |
| 50 | + - python: 3.6 |
| 51 | + modules_tool: ${{needs.setup.outputs.lmod8}} |
| 52 | + module_syntax: Lua |
| 53 | + lc_all: C |
| 54 | + fail-fast: false |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + |
| 58 | + - name: set up Python |
| 59 | + uses: actions/setup-python@v2 |
| 60 | + with: |
| 61 | + python-version: ${{matrix.python}} |
| 62 | + architecture: x64 |
| 63 | + |
| 64 | + - name: install OS & Python packages |
| 65 | + run: | |
| 66 | + # disable apt-get update, we don't really need it, |
| 67 | + # and it does more harm than good (it's fairly expensive, and it results in flaky test runs) |
| 68 | + # sudo apt-get update |
| 69 | + # for modules tool |
| 70 | + sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev |
| 71 | + # fix for lua-posix packaging issue, see https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082 |
| 72 | + # needed for Ubuntu 18.04, but not for Ubuntu 20.04, so skipping symlinking if posix.so already exists |
| 73 | + if [ ! -e /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so ] ; then |
| 74 | + 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 |
| 75 | + fi |
| 76 | +
|
| 77 | + - name: install modules tool |
| 78 | + run: | |
| 79 | + # avoid downloading modules tool sources into easybuild-framework dir |
| 80 | + cd $HOME |
| 81 | + export INSTALL_DEP=$GITHUB_WORKSPACE/easybuild/scripts/install_eb_dep.sh |
| 82 | + # install Lmod |
| 83 | + source $INSTALL_DEP ${{matrix.modules_tool}} $HOME |
| 84 | + # changes in environment are not passed to other steps, so need to create files... |
| 85 | + echo $MOD_INIT > mod_init |
| 86 | + echo $PATH > path |
| 87 | + if [ ! -z $MODULESHOME ]; then echo $MODULESHOME > moduleshome; fi |
| 88 | +
|
| 89 | + - name: test bootstrap script |
| 90 | + run: | |
| 91 | + # (re)initialize environment for modules tool |
| 92 | + if [ -f $HOME/moduleshome ]; then export MODULESHOME=$(cat $HOME/moduleshome); fi |
| 93 | + source $(cat $HOME/mod_init); type module |
| 94 | + # also pick up changes to $PATH set by sourcing $HOME/mod_init |
| 95 | + export PATH=$(cat $HOME/path) |
| 96 | +
|
| 97 | + # define $EASYBUILD_MODULES_TOOL only for oldest module tools |
| 98 | + # (for Lmod and EnvironmentModules 4.x the bootstrap script should correctly auto-detect the modules tool) |
| 99 | + if [[ ${{matrix.modules_tool}} =~ ^modules-tcl- ]]; then |
| 100 | + export EASYBUILD_MODULES_TOOL=EnvironmentModulesTcl |
| 101 | + elif [[ ${{matrix.modules_tool}} =~ ^modules-3 ]]; then |
| 102 | + export EASYBUILD_MODULES_TOOL=EnvironmentModulesC |
| 103 | + fi |
| 104 | +
|
| 105 | + # version and SHA256 checksum are hardcoded below to avoid forgetting to update the version in the script along with contents |
| 106 | + EB_BOOTSTRAP_VERSION=$(grep '^EB_BOOTSTRAP_VERSION' easybuild/scripts/bootstrap_eb.py | sed 's/[^0-9.]//g') |
| 107 | + EB_BOOTSTRAP_SHA256SUM=$(sha256sum easybuild/scripts/bootstrap_eb.py | cut -f1 -d' ') |
| 108 | + EB_BOOTSTRAP_FOUND="$EB_BOOTSTRAP_VERSION $EB_BOOTSTRAP_SHA256SUM" |
| 109 | + EB_BOOTSTRAP_EXPECTED="20210106.01 c2d93de0dd91123eb4f51cfc16d1f5efb80f1d238b3d6cd100994086887a1ae0" |
| 110 | + test "$EB_BOOTSTRAP_FOUND" = "$EB_BOOTSTRAP_EXPECTED" || (echo "Version check on bootstrap script failed $EB_BOOTSTRAP_FOUND" && exit 1) |
| 111 | +
|
| 112 | + # test bootstrap script |
| 113 | + export PREFIX=/tmp/$USER/$GITHUB_SHA/eb_bootstrap |
| 114 | + python easybuild/scripts/bootstrap_eb.py $PREFIX |
| 115 | + # unset $PYTHONPATH to avoid mixing two EasyBuild 'installations' when testing bootstrapped EasyBuild module |
| 116 | + unset PYTHONPATH |
| 117 | + # simple sanity check on bootstrapped EasyBuild module |
| 118 | + module use $PREFIX/modules/all |
| 119 | + module load EasyBuild |
| 120 | + eb --version |
0 commit comments