This action provides the following functionality for GitHub Actions users:
- Builds and installs the following executables:
micropython- The micropython runtime. Can be used to run unit tests in conjunction with libraries such as micropython'sunittest.mpy-cross- The micropython cross-compiler. Used to cross-compile precompiled bytecode for specific microcontroller architectures.
- Provides a clone of the micropython repository (with submodules initialized) and sets the environment variable
MPY_DIRto its path.- Can be used for artifact building, like using native machine code in mpy files.
- Note: on a cache hit,
MPY_DIRcontains the source tree, submodules, and the cachedmpy-crossbinary, but not the Unix port build artifacts.
- Builds are automatically cached, speeding up subsequent runs.
This action only supports Linux runners.
Simply add the following step to your workflow:
steps:
- name: Install MicroPython
uses: BrianPugh/install-micropython@v3The install-micropython action can be configured by setting values under the with: key.
For example:
steps:
- uses: BrianPugh/install-micropython@v3
with:
reference: v1.20.0Input configuration arguments are described as follows.
The micropython git url to clone from. Defaults to the official micropython repository.
with:
repository: https://github.com/micropython/micropythonA git reference (tag, commit, or branch) of the micropython repository to use.
Tags are fetched with a fast shallow clone; branches and commit SHAs use a full clone so the built interpreter still reports an accurate git describe-based version string.
with:
reference: v1.20.0When compiling the micropython Unix port binary, this value gets passed along to environment variable CFLAGS_EXTRA.
This can be used to enable/disable certain micropython features.
It is intentionally not applied to the mpy-cross build, whose fixed feature configuration is incompatible with many otherwise-valid feature flags.
Note that CFLAGS_EXTRA remains exported for all subsequent steps of the job.
with:
cflags: '-DMICROPY_PY_RE_MATCH_GROUPS=1'Whether to initialize MicroPython's submodules so that MPY_DIR is fully usable (e.g. for natmod builds), even when the binaries were restored from cache.
Defaults to true.
Set to false to shave ~30 seconds off cached runs if you only need the micropython/mpy-cross binaries.
Submodules are always initialized when building from source, regardless of this setting.
with:
submodules: false'true' if the binaries were restored from cache, 'false' if they were built from source.
The resolved MicroPython commit SHA that was installed.
steps:
- uses: BrianPugh/install-micropython@v3
id: install
- run: echo "Installed micropython ${{ steps.install.outputs.sha }} (cache-hit=${{ steps.install.outputs.cache-hit }})"