Skip to content

tools/ci.sh: Allow CI tests to run locally.#1104

Open
tsukasa-au wants to merge 1 commit into
micropython:masterfrom
tsukasa-au:run-ci-outside-github
Open

tools/ci.sh: Allow CI tests to run locally.#1104
tsukasa-au wants to merge 1 commit into
micropython:masterfrom
tsukasa-au:run-ci-outside-github

Conversation

@tsukasa-au

Copy link
Copy Markdown

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:

# 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'

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>
@projectgus projectgus self-requested a review June 3, 2026 05:38
Comment thread tools/ci.sh
# package tests

MICROPYTHON=/tmp/micropython/ports/unix/build-standard/micropython
VIRTUAL_ENV="${VIRTUAL_ENV:-/tmp/micropython-venv}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants