Skip to content

Contributing

Development setup

git clone https://github.com/voodoomods/microgoose
cd microgoose
python -m pip install -e . -r requirements-dev.txt
python -m microgoose run examples/hello.goose     # builds in the checkout
python -m pytest            # unit tests
python -m ruff check .      # lint
python -m mkdocs serve      # this site, live at http://127.0.0.1:8000

The commands go through python -m so that they work whether or not pip's scripts folder is on your PATH. Where it is, microgoose, ruff and mkdocs work by name too.

Build cache

A clean ESP32 build compiles about 950 files and takes 5 minutes on our PC. PlatformIO can keep each object it compiles in a folder and copy it back where it would compile the same thing again. It is off until you name the folder, in a file beside firmware/platformio.ini that git ignores:

; firmware/platformio.local.ini
[platformio]
build_cache_dir = ~/.microgoose/build-cache

What to expect, measured on the ESP32-S3 on our PC (one run each):

  • With the cache filled, a clean build took 60 to 90 seconds where it took 5 min 20 s without. That is the build after you delete firmware/.pio, and the one microgoose starts from clean when the build configuration changed.
  • PlatformIO starts the next build from clean, for both ESP32 targets, when you add, change or remove the file. The one after you add it fills the cache.
  • A changed configuration compiles what it touches and takes the rest from the cache: one mbedtls option compiled 808 of the 956 files. Every object of that build matched a build without the cache, apart from the three that hold the build's date.
  • It only works within one folder. Compile commands carry the project's path, so a second checkout or a git worktree takes nothing from the cache and adds its own objects to it. Leave the file out of those.
  • The build that fills it took 6% longer (342 s against 322 s), and one target takes 190 MB. Nothing removes old entries, and each build that links adds its firmware image, about 5 MB. Delete the folder whenever it has grown too big.

CI keeps the same cache for its ESP32 jobs, under a key made from the build configuration: a new configuration starts an empty one.

What CI checks

Every pull request runs the jobs below. main only accepts changes that pass all of them.

Job What it catches
lint Python style and common bugs (ruff)
unit tests regressions in the source fixes (microgoose/core.py) and the benchmark harness, compiler/runtime version mismatches, and benchmark report tables that no longer match the stored runs
host 32-bit conformance stock samples built with gcc -m32 through the full pipeline and diffed against goose run; catches layout bugs without hardware
firmware (s3, esp32, h7) every example builds for every target
emulate (s3, esp32, h7, pico2w) each target's firmware runs in its emulator (QEMU for the ESP32s, Renode for the H7, picoem for the Pico 2 W): every stock sample its board runs matches the PC, and a data stack overflow hits the hardware guard (not on the Pico 2 W: picoem doesn't enforce the MPU)
package the sdist and wheel build, and the installed wheel fetches Goose and builds firmware
docs this site builds with no broken links (mkdocs build --strict)

The Goose compiler CI uses is pinned by version and SHA-256 in .github/actions/setup-goose. The PlatformIO platforms and the Python tools are pinned as well, in the platformio.ini files and requirements-dev.txt.

Licence headers

Every source file (.py, .c, .h, .goose) starts with these two lines, written in that file's comment syntax:

// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 VoodooMods

tests/test_headers.py fails the build if one is missing. Contributions are accepted under the project's Apache-2.0 licence (Section 5 of the licence).

Testing on hardware

CI can't run on a board, so if a change touches a port, the HAL or the fixes, run the stock samples on real hardware:

python tests/conformance.py --target s3
python tests/conformance.py --target h7
python tests/conformance.py --target esp32 --port COM7

--port names the board's serial port when more than one ESP32 is plugged in.

Each sample's PC output and board output are saved to build/conformance/<target>/. Say in the pull request which boards you ran.

Without the board, the same run works in its emulator (CI does this on every pull request). It checks output, not timing:

python tests/conformance.py --target s3 --emulate

Releasing

  1. Bump __version__ in microgoose/__init__.py and add a CHANGELOG.md entry, in a pull request. CI's first steps jobs install the wheel the way a new user does and run the first commands of Getting started, on Windows with the command off PATH and on Ubuntu's own Python.
  2. After it merges, tag main and push the tag, naming the commit: git tag -a v0.2.1 COMMIT -m "MicroGoose 0.2.1", then git push origin v0.2.1.
  3. release.yml builds the sdist and wheel, checks that the tag matches the version, and smoke-tests the exact files. It then waits for approval on the pypi environment.
  4. Approve it under Actions (Review deployments → tick pypi → Approve and deploy). It publishes to PyPI with Trusted Publishing, so no tokens are involved, and creates the GitHub release.
  5. Install it from PyPI on a PC that has never had it (pip install microgoose), and run Getting started's first program on a board.

Version tags are protected: they can't be moved or deleted.

Layout

Path What
microgoose/ the package: core.py (pipeline, fixes, consoles), goose.py (compiler download), cli.py
lib/mcu.goose the Goose side of the hardware API (lib/esp.goose is its 0.1 name)
components/microgoose/ ESP-IDF component: POSIX shim, HAL, main task
firmware/ ESP-IDF project for s3 and esp32
ports/stm32h7/ STM32H743 port (FreeRTOS)
ports/nano/ AVR build probe (not a working port)
tests/ unit tests, host 32-bit check, board conformance
docs/ this site (mkdocs.yml configures it)
overrides/ the site's page head: titles, social cards and structured data for search engines