-
Notifications
You must be signed in to change notification settings - Fork 213
add custom GitHub Actions workflow to run tests with Python 3.6 in Ubuntu 20.04 container #4790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
boegel
wants to merge
4
commits into
easybuilders:develop
Choose a base branch
from
boegel:github-actions-python36
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4111f90
add custom GitHub Actions workflow to run tests with Python 3.6 in Ub…
boegel 1f3c300
Merge branch 'develop' into github-actions-python36
boegel 3c9a12d
use ubuntu-latest in CI workflow to run test suite with Python 3.6 vi…
boegel 5a569ec
Merge branch 'develop' into github-actions-python36
boegel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions | ||
name: EasyBuild framework unit tests (Python 3.6) | ||
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_python36: | ||
runs-on: ubuntu-22.04 | ||
container: | ||
# Ubuntu 20.04 container that already includes Python 3.6 + Lmod & co, | ||
# see https://github.com/easybuilders/easybuild-containers | ||
image: ghcr.io/easybuilders/ubuntu-20.04-python36-amd64 | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | ||
|
||
- name: install Python packages | ||
run: | | ||
# Python packages | ||
python3.6 -V | ||
python3.6 -m pip --version | ||
python3.6 -m pip install --upgrade pip | ||
python3.6 -m pip --version | ||
python3.6 -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 python3.6 -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 | ||
python3.6 setup.py sdist | ||
ls dist | ||
export PREFIX=/tmp/$USER/$GITHUB_SHA | ||
python3.6 -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/python3.6/site-packages:$PYTHONPATH" | ||
ENV_CMDS="${ENV_CMDS}; export EB_VERBOSE=1; export EB_PYTHON=python3.6" | ||
# 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}; python3.6 -O -m test.framework.suite" | ||
# 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) | ||
sudo -u easybuild bash -l -c "${ENV_CMDS}; export LC_ALL=C; python3.6 -O -m test.framework.suite" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.