tools/ci.sh: Allow CI tests to run locally.#1104
Conversation
When working on code in this repo, it can be beneficial to run the same tests that run as part of the CI workflow on GitHub. This change makes it possible to run `tools/ci.sh` without it messing with your user-wide micropython install (`~/.micropython/lib`). It now defaults to creating a virtual environment in `/tmp/micropython-venv`. Expected usage of this is: ```bash # Setup tests (run once) $ source tools/ci.sh $ ci_package_tests_setup_micropython # Run tests (run many times) $ ci_package_tests_setup_lib && ci_package_tests_run || echo 'Failed' ``` Signed-off-by: Greg Darke <micropython@me.tsukasa.au>
| # package tests | ||
|
|
||
| MICROPYTHON=/tmp/micropython/ports/unix/build-standard/micropython | ||
| VIRTUAL_ENV="${VIRTUAL_ENV:-/tmp/micropython-venv}" |
There was a problem hiding this comment.
Hardcoding /tmp should probably be left as a last resort - POSIX specs say there should be an environment variable called TMPDIR pointing to the temporary directory.
See also https://en.wikipedia.org/wiki/TMPDIR
There was a problem hiding this comment.
I agree that it would be better to put these somewhere other than /tmp, but the existing script uses /tmp a lot.
Would you prefer I switch just this (new) usage of /tmp to ${TMPDIR}, or should I switch the other usages of /tmp in this script as well?
There was a problem hiding this comment.
I'd be easier to read if there's one commit that replaces all existing instances of /tmp to ${TMPDIR:-/tmp} first, and then have the existing changes into a follow-up commit. Whether the commits should be split into two separate PRs or not is a bit of personal preference IMHO (technically the first commit could be a valid PR in its own right).
As far as I know GitHub doesn't allow declaring dependencies on PRs, so let's keep both commits in here to make sure nothing gets lost if this gets merged. Thanks!
When working on code in this repo, it can be beneficial to run the same tests that run as part of the CI workflow on GitHub.
This change makes it possible to run
tools/ci.shwithout it messing with your user-wide micropython install (~/.micropython/lib). It now defaults to creating a virtual environment in/tmp/micropython-venv.Expected usage of this is: