Skip to content

Update to use pre compiled mpy-cross binaries #19

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
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# SPDX-FileCopyrightText: 2022 Alec Delaney, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT

name: Build CI

on: [pull_request, push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.x (Latest)
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Checkout current repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
# SPDX-FileCopyrightText: 2022 Alec Delaney, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Build CI
on: [pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.x (Latest)
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Checkout current repo
uses: actions/checkout@v4
with:
submodules: true
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
38 changes: 19 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# SPDX-FileCopyrightText: 2022 Alec Delaney, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT

repos:
- repo: https://github.com/python/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
# SPDX-FileCopyrightText: 2022 Alec Delaney, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
repos:
- repo: https://github.com/python/black
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v3.0.2
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
31 changes: 16 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ build-mpy
=========

GitHub Action for building packages of ``.mpy`` files for CircuitPython projects and attaching them to releases
as ZIP files. Files other than ``.mpy`` and ``.py`` files will be added to the ZIP file as well. Note that
any files named or ``code.py`` are automatically not compiled for convenience.
as ZIP files. Files other than ``.mpy`` and ``.py`` files will be added to the ZIP file as well. Note that
``code.py`` and any files excluded via the `mpy-manifest-file` are not compiled.
Copy link
Preview

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

[nitpick] The backticks around 'mpy-manifest-file' are inconsistent with the rest of the documentation which uses double backticks for code elements. Should be mpy-manifest-file to match the style.

Suggested change
``code.py`` and any files excluded via the `mpy-manifest-file` are not compiled.
``code.py`` and any files excluded via the ``mpy-manifest-file`` are not compiled.

Copilot uses AI. Check for mistakes.


Inputs
======

======================= ===================================================================== ==================== =====================================================================
Argument Name Description Default Notes
======================= ===================================================================== ==================== =====================================================================
github-token Your GitHub token N/A N/A
circuitpy-tag The version of CircuitPython to compile for N/A You can use any valid tag (or branch) from ``adafruit/circuitpython``
github-token Your GitHub token N/A (required) N/A
circuitpy-version The version of CircuitPython to download and use N/A (required) You can specify any version from ``https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross``
zip-filename The name of the ZIP file that will be attached "mpy-release.zip" N/A
circuitpython-repo-name The name of the clone CircuitPython repo "circuitpython-repo" Change if it conflicts with another file
mpy-directory The directory to search for files to compile "." (top folder) Becomes the basis for filepaths in ``mpy-manifest-file``
mpy-manifest-file A file with a list of files to compile or exclude "" If none is given, all files in ``mpy-directory`` are used
mpy-manifest-type Whether the files in the manifest file should be included or excluded "include" N/A
zip-directory The directory to add to the ZIP file "." (top folder) Becomes the basis for filepaths in ``zip-manifest-file``
zip-manifest-file A file with a list of files to add to the ZIP file or exclude from it "" If none is given, all files in ``zip-directory`` are used
zip-manifest-type Whether the files in the manifest file should be included or excluded "include" N/A
compiler-directory The directory where the CircuitPython compiler will be downloaded "circuitpy-compiler" N/A
======================= ===================================================================== ==================== =====================================================================

Examples
========

If you have just a repository with files intended for a CircuitPython board, your release
file could be very simple! This release CI creates .mpy files for CircuitPython 8.2.0:
file could be very simple!

.. code-block:: yaml

Expand All @@ -48,19 +48,20 @@ file could be very simple! This release CI creates .mpy files for CircuitPython
runs-on: ubuntu-latest
steps:
- name: Checkout the current repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Run MPY Action
uses: adafruit/build-mpy@v1
uses: adafruit/build-mpy@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
circuitpy-tag: "8.2.0"
circuitpy-version: "9.2.8"

You also have granular control of which directories to compile and zip and the ability to specify which
files should or should not be compiled and/or zipped. For example, if you wanted to compile and zip
files in a folder named ``microcontroller`` and you wanted to use a manifest file named ``mpy_manifest.txt``
to specify certain files NOT to compile, you could modify the script above to be:
files should or should not be compiled and/or zipped as well as the ability to specify a different CircuitPython version.
For example, if you wanted to compile and zip files in a folder named ``microcontroller`` and you wanted to
use a manifest file named ``mpy_manifest.txt`` to specify certain files NOT to compile, using CircuitPython
version ``9.2.8``, you could modify the script above to be:

.. code-block:: yaml

Expand All @@ -73,14 +74,14 @@ to specify certain files NOT to compile, you could modify the script above to be
runs-on: ubuntu-latest
steps:
- name: Checkout the current repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Run MPY Action
uses: adafruit/build-mpy@v1
uses: adafruit/build-mpy@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
circuitpy-tag: "8.2.0"
circuitpy-version: "9.2.8"
mpy-directory: "microcontroller"
mpy-manifest-file: "mpy_manifest.txt"
mpy-manifest-type: "exclude"
Expand Down
Loading