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

Conversation

jake1164
Copy link
Contributor

build-mpy stopped working and compiling the CircutPython version so I made the changes indicated in #17. I removed the CircuitPython checkout and replaced it with pulling the default (current 8.0.5) version of mpy-cross. I also added the ability to specify a specific version of mpy-cross.

Changed from fetch-submodules to fetch-all-submodules.

The error message "No rule to make target 'fetch-submodules'. Stop." might be resolved by using the correct make targets. Here are some relevant findings from the adafruit/circuitpython repository:

Makefile Targets:

fetch-translate-submodules: Fetches submodules for translation.
fetch-all-submodules: Fetches submodules for all ports.
Relevant Issues:

Issue #9301: Discusses issues with submodule fetching in CI actions.
Issue #9552: Details on setup documentation and fetching submodules for the Espressif build environment.
Issue #8027: Provides information on issues related to building with submodules.
To resolve the issue, you can try running:

make fetch-all-submodules
For more details on related issues, you can view the full list of discussions here.
@jake1164
Copy link
Contributor Author

Not sure if there is a better way or maybe not include a default version, the default version could get outdated pretty quickly and require frequent changes. Any thoughts or preferences? I guess based on the change frequency I would lean no default and the user having to specify the version.

@tekktrik
Copy link
Member

Hi! Sorry this slipped by me, let me take a look over the next couple days and get back to you!

@tekktrik tekktrik self-requested a review March 10, 2025 18:00
@jake1164
Copy link
Contributor Author

jake1164 commented Mar 10, 2025 via email

Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

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

I am so sorry for the late review. I really like this idea of using the pre-comipled binary. I think there are a couple of API-like changes I'd want to keep retained, but on the whole this is a great change! Let me know if you're still able to work on this, or I can take it from here if you've unfortunately had to move on.

README.rst Outdated
@@ -20,9 +20,8 @@ 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``
mpy-cross-version The version of mpy-cross to download and use 9.2.4 You can specify any version from ``https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross/linux-amd64``
Copy link
Member

Choose a reason for hiding this comment

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

I think this might be a little overwhelming and translates to the same effect as the CircuitPython version. I think this name and description should remain as is, so it's easier for people to understand exactly which version they should be selecting. In that case, changing it to circuitpy-version would also be appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree this makes it more user friendly.

action.yml Outdated
cd ${{ inputs.circuitpython-repo-name }}/mpy-cross
make clean
make
mkdir mpy-cross
Copy link
Member

Choose a reason for hiding this comment

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

Having the escape hatch of the folder name being customizable is nice in the VERY rare event it conflicts with something in the user's repository. I'd keep this functionality included, though I'd rename it to something more appropriate if we're downloading the pre-compiled binary. Altertnatively, you could just place it in the root folder, in which case I agree the escape hatch isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this option.

README.rst Outdated
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 mpy-cross
Copy link
Member

Choose a reason for hiding this comment

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

This is just missing a period at the end of the sentence. I would also make this refer to the version of CircuitPython instead of specifically to the mpy-cross version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as well as fixed some other typo's.

@jake1164
Copy link
Contributor Author

jake1164 commented May 23, 2025 via email

@tekktrik
Copy link
Member

tekktrik commented Aug 7, 2025

Hi! Just checking in to see if you're still working on this. I'm happy to build off of what you've submitted otherwise.

@jake1164
Copy link
Contributor Author

jake1164 commented Aug 7, 2025 via email

@Copilot Copilot AI review requested due to automatic review settings August 10, 2025 14:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the build-mpy action to use pre-compiled mpy-cross binaries instead of building from source. The change addresses issues with the previous approach that stopped working and improves the build process by downloading pre-compiled binaries from Adafruit's S3 bucket.

Key changes include:

  • Replaced CircuitPython source compilation with pre-compiled binary download
  • Updated input parameter names for better clarity
  • Corrected spelling errors in documentation and comments

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
action.yml Replaced CircuitPython repo cloning and compilation with direct mpy-cross binary download, updated input parameters
README.rst Updated documentation to reflect new parameter names and usage examples
.pre-commit-config.yaml Updated pre-commit hook versions
.github/workflows/build.yml Updated GitHub Actions versions

description: >
The type of manifest to use for compiling if one is provided. The
default is "include", but if "exclude" is provided, then all Python
files EXCEPT the ones listed will be compiled with CircuitPython.
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.

The error message is incorrect. Files are compiled with mpy-cross, not 'with CircuitPython'. Should be 'will be compiled with mpy-cross.'

Copilot uses AI. Check for mistakes.

action.yml Outdated
mkdir ${{ inputs.compiler-directory }}
cd ${{ inputs.compiler-directory }}
wget -O mpy-cross https://adafruit-circuit-python.s3.amazonaws.com/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ inputs.circuitpy-version }}
chmod +x mpy-cross
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.

The wget command lacks error handling. If the download fails (e.g., invalid version or network issues), the action will continue and fail later with unclear errors. Consider adding error checking or using curl with fail options.

Suggested change
chmod +x mpy-cross
wget -O mpy-cross https://adafruit-circuit-python.s3.amazonaws.com/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ inputs.circuitpy-version }} || { echo "Error: Failed to download mpy-cross for version ${{ inputs.circuitpy-version }}"; exit 1; }
chmod +x mpy-cross

Copilot uses AI. Check for mistakes.

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.

@jake1164
Copy link
Contributor Author

Latest release of my clock uses this and works.
Here is the run

I'll do some further testing later but the changes submitted do at least work and have been tested.

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