Commit Graph

103 Commits

Author SHA1 Message Date
Damien George
1291718916 github/workflows: Free up disk space on zephyr workflow.
The zephyr builds take up quite a lot of space.

Signed-off-by: Damien George <damien@micropython.org>
2024-10-03 10:36:27 +10:00
Alessandro Gatti
8a9042a72b github/workflows: Update Ubuntu images for code size CI tasks.
This updates the Ubuntu OS image the code size CI tasks run on, from
20.04-LTS to 22.04-LTS.  This is needed because 20.04 didn't have
packages that are needed to build RISC-V 32 code.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-09-23 12:42:07 +10:00
Damien George
659113825d qemu: Rename qemu-arm port to qemu.
Because this port now supports multiple architectures.

Signed-off-by: Damien George <damien@micropython.org>
2024-09-06 11:08:39 +10:00
Damien George
0426934969 qemu-arm: Merge RISC-V 32-bit support into qemu-arm port.
Currently both the qemu-arm and qemu-riscv ports share a lot of code and
functionality.  This commit merges the qemu-riscv port into the qemu-arm
port.  The only real differences between the two are the toolchains used to
build the code, and the initialisation/startup framework.  Everything else
is pretty much the same, so this brings the following benefits:
- less code duplication
- less burden on maintenance
- generalised qemu port, could in the future support other architectures

A new board `VIRT_RV32` has been added to the qemu-arm port which is the
existing RISC-V board from the qemu-riscv port.  To build it:

    $ make BOARD=VIRT_RV32 repl

To cleanly separate the code for the different architectures, startup code
has been moved to ports/qemu-arm/mcu/<arch>/.

Signed-off-by: Damien George <damien@micropython.org>
2024-09-04 16:46:39 +10:00
Damien George
d9a0fdda9a qemu-arm: Rework to provide a REPL and run tests via a pty serial port.
Currently, the qemu-arm (and qemu-riscv) port has two build modes:
- a simple test that executes a Python string; and
- a full test that uses tinytest to embed all tests within the firmware,
  then executes that and captures the output.

This is very different to all the other ports.  A difficulty with using
tinytest is that with the large number of tests the firmware overflows its
virtual flash size.  It's also hard to run tests via .mpy files and with
the native emitter.  Being different to the other ports also means an extra
burden on maintenance.

This commit reworks the qemu-arm port so that it has a single build target
that creates a standard firmware which has a REPL.  When run under
qemu-system-arm, the REPL acts like any other bare-metal port, complete
with soft reset (use machine.reset() to turn it off and exit
qemu-system-arm).

This approach gives many benefits:
- allows playing with a REPL without hardware;
- allows running the test suite as it would on a bare-metal board, by
  making qemu-system-arm redirect the UART serial of the virtual device to
  a /dev/pts/xx file, and then running run-tests.py against that serial
  device;
- skipping tests is now done via the logic in `run-tests.py` and no longer
  needs multiple places to define which tests to skip
  (`tools/tinytest-codegen.py`, `ports/qemu-arm/tests_profile.txt` and also
  `tests/run-tests.py`);
- allows testing/using mpremote with the qemu-arm port.

Eventually the qemu-riscv port would have a similar change.

Prior to this commit the test results were:

    743 tests ok.  (121 skipped)

With this commit the test results are:

    753 tests performed (22673 individual testcases)
    753 tests passed
    138 tests skipped

More tests are skipped because more are included in the run. But overall
more tests pass.

Signed-off-by: Damien George <damien@micropython.org>
2024-08-28 11:52:08 +10:00
Damien George
c8838b5004 github/workflows: Add CI to run tests against zephyr with qemu.
With this change, the zephyr port is tested against the standard test suite
via the following scheme:
- the zephyr port is built with the `qemu_cortex_m3` board and the
  `prj_minimal.conf` configuration
- `qemu-system-arm` runs `zephyr.elf`
- the zephyr console is redirected to a pts/pty
- `tests/run-tests.py` is run in bare-metal mode against the pts/pty device

This allows testing the zephyr port as though it were a physical board
attached over a serial port.

Signed-off-by: Damien George <damien@micropython.org>
2024-08-28 11:23:11 +10:00
Alessandro Gatti
17f254df35 github/workflows: Add RISC-V 64 bits Unix port to CI.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-07-25 16:45:04 +10:00
stijn
1f907a2f5c tests/run-tests.py: Make Windows test skipping more granular.
Signed-off-by: stijn <stijn@ignitron.net>
2024-07-25 16:24:04 +10:00
stijn
a0c7bf12d2 github/workflows: Improve MSYS2-based CI builds.
Install the mingw variant of Python since it behaves more like a 'real'
Windows CPython than the msys2 variant: os.name == 'nt', not 'posix'.  Note
that os.sep is still '/' though so we don't actually need to skip the
import_file test.  This way one single Python version can be used both for
running run-tests.py and getting the expected test output.

Signed-off-by: stijn <stijn@ignitron.net>
2024-07-25 16:22:21 +10:00
Damien George
abbce268af github/workflows: Use macos-latest for unix macos CI.
macos-11.0 is no longer available.

With this change in the macos version, some tests which previously failed
now pass, and some different tests now fail.  Exclude those that fail from
the CI until they can be fixed properly.

Signed-off-by: Damien George <damien@micropython.org>
2024-07-15 11:10:00 +10:00
Angus Gratton
0c28a5ab06 github: Add Pull Request template.
Provides pull request submitters with contributor documentation, and
prompts them to provide relevant information about testing, and how they
came to implement this change.

Sections are deliberately small so they don't crowd out the GitHub Pull
Request description text field.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-06-26 14:47:13 +10:00
Alessandro Gatti
1b10cb843c github/workflows: Add qemu-riscv port to CI.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-06-17 12:06:09 +10:00
Angus Gratton
c1a6b95bf2 github/ISSUE_TEMPLATE: Update issue form to remove checklist generation.
Update to the issue forms added earlier this year, that seem to generally
be working well.  Improvements in this commit:

- No longer generates TODO checklists in new issues.

- Issue bodies (and therefore email previews) no longer start with the same
  fixed checklist text for each new issue.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-31 22:17:45 +10:00
Damien George
49ce7a6075 github/workflows: Run code size workflow on shared or port code changes.
To get more insight to firmware size changes when code changes.

Signed-off-by: Damien George <damien@micropython.org>
2024-04-22 12:38:29 +10:00
J. Neuschäfer
f76cf29402 github/workflows: Update coverage workflow to codecov-action@v4.
Fixes: https://github.com/micropython/micropython/issues/14340

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
2024-04-20 19:43:50 +02:00
Damien George
35b2edfc24 github/workflows: Add Biome workflow for JavaScript formatting/linting.
Enable Biome on all of webassembly port and tests.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-22 14:31:25 +11:00
iabdalkader
486ca3a688 tools/ci.sh: Add Arduino GIGA to stm32 CI build.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
Phil Howard
dda9b9c6da all: Prune trailing whitespace.
Prune trailing whitespace across the whole project (almost), done
automatically with:

    grep -IUrl --color "[[:blank:]]$" --exclude-dir=.git --exclude=*.exp |\
        xargs sed -i 's/[[:space:]]*$//'

Exceptions:
- Skip third-party code in lib/ and drivers/cc3100/
- Skip generated code in bluetooth_init_cc2564C_1.5.c
- Preserve command output whitespace in docs, eg:
  docs/esp8266/tutorial/repl.rst

Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-03-07 16:25:17 +11:00
Angus Gratton
4f7d0df9bc github/ISSUE_TEMPLATE: Convert issue templates to forms.
Allows giving more specific advice, provides more links to other places to
ask questions, check details, etc.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-24 20:02:51 +11:00
Angus Gratton
781366e476 github/workflows: Standardise formatting of ruff.yml.
All the other workflow YAML files use vertical whitespace around top-level
items.

Also remove spurious comment, the features in the linked doc aren't
actually used in this workflow (any more?).

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-07 15:22:41 +11:00
Angus Gratton
6f0aa275f8 github/workflows: Add comments where tool versions need to be in sync.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-07 15:21:55 +11:00
Angus Gratton
84e90639fa github/workflows: Move codespell to a GitHub workflow, version it.
Similar to ruff.yaml, it's simpler to run the codespell command directly
from a workflow file.  And developers can run codespell directly from the
command line without the need for options, or just use pre-commit.

This commit also applies a specific version to codespell, same as
pre-commit (introduced in a166d805f4).

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-07 15:19:38 +11:00
Damien George
ff73683077 github/workflows: Initialise micropython-lib submodule for windows CI.
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07 12:58:34 +11:00
Damien George
5a68e82d17 github/workflows: Bump setup-msbuild, setup-python, checkout versions.
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07 11:28:52 +11:00
David Lechner
ed15b3c6c6 github/workflows: Move Windows CI from AppVeyor to GitHub Actions.
By moving to GitHub actions, all MicroPython CI builds are now on GitHub
actions.  This allows faster parallel builds and saves time by not building
when no relevant files changed.

This reveals a few failing tests, so those are temporarily disabled until
they can be fixed.

Signed-off-by: David Lechner <david@pybricks.com>
Signed-off-by: Damien George <damien@micropython.org>
2024-02-06 09:50:03 +11:00
Damien George
8eb658f654 github/workflows: Run mimxrt and rp2 CI with space in repository path.
To test building with make and cmake when there is a space in the path.

Signed-off-by: Damien George <damien@micropython.org>
2024-01-24 11:07:00 +11:00
dependabot[bot]
f93ffc2875 github/workflows: Bump actions/cache from 3 to 4.
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-22 11:37:37 +11:00
dependabot[bot]
de3e83aa4d github/workflows: Bump actions/upload-artifact from 3 to 4.
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact)
from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 16:14:43 +11:00
dependabot[bot]
be64641210 github/workflows: Bump actions/setup-python from 4 to 5.
Bumps [actions/setup-python](https://github.com/actions/setup-python) from
4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 16:13:15 +11:00
dependabot[bot]
d506b53377 github/workflows: Bump actions/github-script from 6 to 7.
Bumps [actions/github-script](https://github.com/actions/github-script)
from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 16:09:55 +11:00
Damien George
d3595fed2b tools/ci.sh: Build ESP32_GENERIC-SPIRAM as part of esp32 CI.
Signed-off-by: Damien George <damien@micropython.org>
2023-12-06 12:37:25 +11:00
Angus Gratton
527c4b0497 github/workflows: Enable ccache for esp32 build.
CCaches are scoped per-job.

Uses https://github.com/hendrikmuhs/ccache-action to get desired behaviour
(updating the cache on each run).

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-12-06 12:15:33 +11:00
Angus Gratton
731a1f5233 github/workflows: Enable build matrix for stm32 port.
This is for consistency with the previous commit that uses this approach
for esp32.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-12-06 12:15:20 +11:00
Angus Gratton
b6df8f8452 github/workflows: Use build matrix for esp32 port.
Allows splitting the esp32 job into multiple parts without too much
boilerplate.  The matrix is parameterised using the name of the function to
call in tools/ci.sh, to minimise the dependency on GitHub Actions.

This can get esp32 build times down around 3m if IDF is cached already.

If the cache is cold, the cache preparation step on each job can double up
against each other.  However, restructuring the workflow to not do this
seems either complex or requires copy-pasting the entire cache step.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-12-06 12:13:56 +11:00
Angus Gratton
9f620d2819 github/workflows: Cache ESP-IDF checkout and installation.
Cache is keyed on the ESP-IDF version used in CI, so there shouldn't be any
cache invalidation issues when ESP-IDF version changes.

Restoring from cache takes approx 15s, compared to 2-3m to perform these
steps (ESP-IDF tools install, ESP-IDF clone, ESP-IDF submodule clone) the
first time.

Cache size is approx 1.6GB, the git clone is tweaked as much as possible to
keep the size down.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-12-06 12:12:52 +11:00
Jim Mussared
303ccca7c6 all: Replace "black" with "ruff format".
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format (and only check C
  files when running codeformat.py)
- Update CI.
- Simplify codeformat.py to remove all the Python-specific logic (just run
  "ruff format" directly).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-03 13:30:38 +11:00
Jim Mussared
e579ebb11b teensy: Remove the teensy port.
This port is largely unmaintained, has limited features (the only hardware
support is for GPIO and timer, and no machine module), only supports a
small number of Teensy boards, and can be confused with the mimxrt support
for Teensy 4.x.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
2023-10-31 13:04:41 +11:00
Jim Mussared
3bf70f16e9 py/mkrules.mk: Add MICROPY_PREVIEW_VERSION_2.
This provides a way to enable features and changes slated for MicroPython
2.x, by running `make MICROPY_PREVIEW_VERSION_2=1`. Also supported for
the cmake ports (except Zephyr).

This is an alternative to having a 2.x development branch (or equivalently,
keeping a 1.x release branch). Any feature or change that needs to be
"hidden" until 2.x can use this flag (either in the Makefile or the
preprocessor).

A good example is changing function arguments or other public API features,
in particular to aid in improving consistency between ports.

When `MICROPY_PREVIEW_VERSION_2` is enabled, the REPL banner is amended to
say "MicroPython (with v2.0 preview) vX.Y.Z", and sys.implementation gets a
new field `_v2` set to `True`.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-27 15:28:46 +11:00
Jim Mussared
c2361328e1 github/workflows: Pin ruff to 0.1.0 and change flags for new version.
The `--format` flag was changed to `--output-format` in the recent update.

Pin to this version to prevent further updates from breaking (e.g. through
new rules or other changes).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-17 13:56:33 +11:00
Jim Mussared
5232847771 README.md: Update CI badges.
- Fix URL for the unix badge.
- Add stm32 CI badge.
- Add docs CI badge (linking to the documentation)
- Make docs CI run on push (so we get a badge generated).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-06 16:39:55 +11:00
Jos Verlinde
a93ebd0e03 docs: Add requirements.txt file with dependencies for Sphinx.
Signed-off-by: Jos Verlinde <Jos.Verlinde@Microsoft.com>
2023-10-02 12:35:12 +11:00
dependabot[bot]
5e50593738 github/workflows: Bump actions/checkout from 3 to 4.
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05 11:27:05 +10:00
Damien George
6a9db521ed github/workflows: Update esp32 CI to use IDF v5.0.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:53 +10:00
Damien George
ab3f9ecb59 github/workflows: Force use of Ubuntu-20.04 for unix 32-bit builds.
To be able to install libffi-dev:i386.

Signed-off-by: Damien George <damien@micropython.org>
2023-05-18 13:12:40 +10:00
Christian Clauss
78a1aa1711 github/workflows: Add GitHub Action to lint Python code with ruff.
Signed-off-by: Damien George <damien@micropython.org>
2023-05-02 23:52:11 +10:00
Damien George
b1229efbd1 all: Fix spelling mistakes based on codespell check.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 18:03:06 +10:00
Damien George
e131b53fdf github/workflows: Add spell check to code formatting workflow.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 18:03:06 +10:00
Jim Mussared
82a59a824c github/workflows: Fetch full history for mpremote workflow.
Instead of doing the shallow checkout followed by an unshallow-with-tags,
just set fetch-depth=0 to get the full history to start with.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-27 12:59:22 +10:00
dependabot[bot]
fc4c47f7bc github/workflows: Bump actions/upload-artifact from 2 to 3.
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 11:13:24 +11:00
dependabot[bot]
cd4e53a2fe github/workflows: Bump actions/checkout from 2 to 3.
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 11:11:48 +11:00