From 98d4c594f9aa7d048d3f9d33ecf6f6a949a1a966 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 08:23:48 -0500 Subject: [PATCH 1/8] CI: skip tests and mpy-cross jobs when changes can't affect them The tests job ran on every commit, and mpy-cross and mpy-cross-mac ran whenever any board was built, even though the board builds use the mpy-cross built by the scheduler. ci_set_matrix.py now sets tests and mpy-cross outputs. Each job is skipped only when every changed file matches its ignore list. mpy-cross still always builds on push, so each version's binaries reach S3. The ports job needs tests, so its if: now allows a skipped tests job. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build.yml | 10 +++++++--- tools/ci_set_matrix.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af55b623c63..c284a57f788 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,8 @@ jobs: outputs: docs: ${{ steps.set-matrix.outputs.docs }} zephyr-tests: ${{ steps.set-matrix.outputs.zephyr-tests }} + tests: ${{ steps.set-matrix.outputs.tests }} + mpy-cross: ${{ steps.set-matrix.outputs.mpy-cross }} ports: ${{ steps.set-matrix.outputs.ports }} cp-version: ${{ steps.set-up-submodules.outputs.version }} steps: @@ -99,6 +101,7 @@ jobs: tests: needs: scheduler + if: needs.scheduler.outputs.tests == 'True' uses: ./.github/workflows/run-tests.yml with: cp-version: ${{ needs.scheduler.outputs.cp-version }} @@ -112,7 +115,7 @@ jobs: mpy-cross: needs: scheduler - if: needs.scheduler.outputs.ports != '{}' + if: needs.scheduler.outputs.mpy-cross == 'True' uses: ./.github/workflows/build-mpy-cross.yml secrets: inherit with: @@ -121,7 +124,7 @@ jobs: mpy-cross-mac: runs-on: macos-latest needs: scheduler - if: needs.scheduler.outputs.ports != '{}' + if: needs.scheduler.outputs.mpy-cross == 'True' env: CP_VERSION: ${{ needs.scheduler.outputs.cp-version }} steps: @@ -226,7 +229,8 @@ jobs: ports: needs: [scheduler, tests] - if: needs.scheduler.outputs.ports != '{}' + # Without !failure() and !cancelled(), a skipped tests job would skip this job too. + if: ${{ !failure() && !cancelled() && needs.scheduler.outputs.ports != '{}' }} uses: ./.github/workflows/build-boards.yml secrets: inherit strategy: diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index f95bc1cfb10..eccb42bd4dd 100755 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -81,6 +81,16 @@ r"|^\.github/workflows/zephyr-autogen-pr\.yml$" ) +# Files that can't affect the unix coverage tests: other ports and the documentation. +# The tests build nothing from ports/ except ports/unix. frozen/ is not on this list, +# because run-tests.py puts the frozen asyncio and Ticks libraries on the module search path. +PATTERN_TESTS_IGNORE = re.compile(r"^docs/|^ports/(?!unix/)") + +# Files that can't affect mpy-cross: ports, frozen libraries, the documentation and the tests. +# The board builds don't need the mpy-cross and mpy-cross-mac jobs. They use the mpy-cross +# that the scheduler job builds. +PATTERN_MPY_CROSS_IGNORE = re.compile(r"^(?:docs|frozen|ports|tests)/") + # Zephyr boards don't use make, so their module tables can't be computed here. Each # board's build writes autogen_board_info.toml next to its circuitpython.toml and that # file is committed; a board whose table is missing, unreadable or doesn't name a @@ -384,6 +394,27 @@ def set_zephyr_tests(run: bool): set_output("zephyr-tests", run) +# These don't check last_failed_jobs. If a tests or mpy-cross job failed on the last checked +# commit, ci_changes_per_commit.py reports no commit, so all the pull request's changes are +# checked again. +def set_tests(run: bool): + if not run: + run = any(not PATTERN_TESTS_IGNORE.match(file) for file in changed_files) + + # Set the step outputs + print("Running tests:", run) + set_output("tests", run) + + +def set_mpy_cross(run: bool): + if not run: + run = any(not PATTERN_MPY_CROSS_IGNORE.match(file) for file in changed_files) + + # Set the step outputs + print("Building mpy-cross:", run) + set_output("mpy-cross", run) + + def set_windows(run: bool): if not run: if last_failed_jobs.get("windows"): @@ -411,6 +442,9 @@ def main(): # Set jobs set_docs(run_all) set_zephyr_tests(run_all) + set_tests(run_all) + # Pushes upload each version's mpy-cross binaries to S3, so build them every time. + set_mpy_cross(run_all or os.environ.get("GITHUB_EVENT_NAME") == "push") set_windows(run_all) set_boards(run_all) From d77c4e7fa8a2d1fc85911cb35e6bd53cccaa079e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 08:23:49 -0500 Subject: [PATCH 2/8] CI: remove leftovers from the Windows builds The Windows builds were removed in 3d738312bd. Remove set_windows() and PATTERN_WINDOWS from ci_set_matrix.py, which set an output nothing reads, and the unused windows and windows-zephyr targets from ci_fetch_deps.py. Co-Authored-By: Claude Opus 5.5 --- tools/ci_fetch_deps.py | 12 +----------- tools/ci_set_matrix.py | 34 ---------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 312b87c5ba4..52c131b41f8 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -205,16 +205,6 @@ def main(target): submodules = ["extmod/ulab", "frozen"] elif target == "mpy-cross" or target == "mpy-cross-mac": submodules = ["tools/"] # for huffman - elif target == "windows": - # This builds one board from a number of ports so fill out a bunch of submodules - for port in ("atmel-samd", "nordic", "raspberrypi", "stm"): - submodules.append(f"ports/{port}") - submodules.extend(PORT_DEPS[port]) - unique_submodules = set(submodules) - submodules = list(unique_submodules) - elif target == "windows-zephyr": - submodules.append("ports/zephyr-cp") - submodules.extend(PORT_DEPS["zephyr-cp"]) elif target == "website": submodules = ["tools/adabot", "frozen"] elif target == "pre-commit": @@ -288,6 +278,6 @@ def main(target): run("Sync submodule URLs", "git submodule sync --quiet", cwd=TOP) - # Target will be a board, "test", "docs", "mpy-cross-mac", or "windows" + # Target will be a board, "test", "docs" or "mpy-cross-mac" for target in sys.argv[1:]: main(target) diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index eccb42bd4dd..971583e28d5 100755 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -120,18 +120,6 @@ def zephyr_board_has_module(board, module): return board not in zephyr_modules or zephyr_modules[board].get(module, True) -PATTERN_WINDOWS = { - ".github/", - "extmod/", - "lib/", - "mpy-cross/", - "ports/unix/", - "py/", - "tools/", - "requirements-dev.txt", -} - - def git_diff(pattern: str): return set( subprocess.run( @@ -415,27 +403,6 @@ def set_mpy_cross(run: bool): set_output("mpy-cross", run) -def set_windows(run: bool): - if not run: - if last_failed_jobs.get("windows"): - run = True - else: - for file in changed_files: - for pattern in PATTERN_WINDOWS: - if file.startswith(pattern) and not any( - [file.startswith(path) for path in IGNORE_BOARD] - ): - run = True - break - else: - continue - break - - # Set the step outputs - print("Building windows:", run) - set_output("windows", run) - - def main(): run_all = not changed_files and not compute_diff print("Running: " + ("all" if run_all else "conditionally")) @@ -445,7 +412,6 @@ def main(): set_tests(run_all) # Pushes upload each version's mpy-cross binaries to S3, so build them every time. set_mpy_cross(run_all or os.environ.get("GITHUB_EVENT_NAME") == "push") - set_windows(run_all) set_boards(run_all) From c456ed9290e21d248f94d4949c507426c9bf0f89 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 08:59:10 -0500 Subject: [PATCH 3/8] TEST: board-only change (drop before review) --- ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 6f2c657d127..211a3648309 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY__EVE = 1 CIRCUITPY_PICOGAME = 1 CIRCUITPY_PICODVI = 1 + +# TEST: board-only change (drop before review) From c979bd92f5e44cb03c35dbe46b53b6c0920a59e2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 09:24:41 -0500 Subject: [PATCH 4/8] TEST: unix-only change (drop before review) --- ports/unix/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 62fa4c732e9..1502e7440bb 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -324,3 +324,5 @@ install: $(BUILD)/$(PROG) uninstall: -rm $(BINDIR)/$(PROG) + +# TEST: unix-only change (drop before review) From 49863d488c01b06e5723a4394f956f6371b53327 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 09:39:02 -0500 Subject: [PATCH 5/8] TEST: tests-only change (drop before review) --- tests/basics/int1.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/basics/int1.py b/tests/basics/int1.py index 94723af4d00..b9920f1b4af 100644 --- a/tests/basics/int1.py +++ b/tests/basics/int1.py @@ -103,3 +103,5 @@ def test(value, base): int([]) except TypeError: print("TypeError") + +# TEST: tests-only change (drop before review) From bdc2edf77c1cc255183d8049c537a53714816852 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 09:44:46 -0500 Subject: [PATCH 6/8] TEST: zephyr board-only change (drop before review) --- ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml b/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml index 5ea381dcd6f..16b1d5728ed 100644 --- a/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml +++ b/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml @@ -5,3 +5,5 @@ CIRCUITPY_BUILD_EXTENSIONS = ["hex", "signed.bin"] # board.UART() pins: P0.00/P0.01, the debugger's VCOM0 serial port. TX = 23 RX = 24 + +# TEST: zephyr board-only change (drop before review) From 066ae8f4865ab73fb9cb205a113ea5cf3db8aba0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 09:47:48 -0500 Subject: [PATCH 7/8] TEST: docs-only change (drop before review) --- docs/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 6d73b1837a5..26aeb3869c0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -56,3 +56,5 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` + +.. TEST: docs-only change (drop before review) From 86047248bce07a931d4584af660f798ab3ab2ac5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 19 Nov 2026 10:21:36 -0500 Subject: [PATCH 8/8] Revert the TEST commits Remove the one-line test changes used to check which CI jobs run. Co-Authored-By: Claude Opus 5.5 --- docs/index.rst | 2 -- ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk | 2 -- ports/unix/Makefile | 2 -- ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml | 2 -- tests/basics/int1.py | 2 -- 5 files changed, 10 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 26aeb3869c0..6d73b1837a5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -56,5 +56,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - -.. TEST: docs-only change (drop before review) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 211a3648309..6f2c657d127 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -13,5 +13,3 @@ CIRCUITPY__EVE = 1 CIRCUITPY_PICOGAME = 1 CIRCUITPY_PICODVI = 1 - -# TEST: board-only change (drop before review) diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 1502e7440bb..62fa4c732e9 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -324,5 +324,3 @@ install: $(BUILD)/$(PROG) uninstall: -rm $(BINDIR)/$(PROG) - -# TEST: unix-only change (drop before review) diff --git a/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml b/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml index 16b1d5728ed..5ea381dcd6f 100644 --- a/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml +++ b/ports/zephyr-cp/boards/nordic/nrf54l15dk/circuitpython.toml @@ -5,5 +5,3 @@ CIRCUITPY_BUILD_EXTENSIONS = ["hex", "signed.bin"] # board.UART() pins: P0.00/P0.01, the debugger's VCOM0 serial port. TX = 23 RX = 24 - -# TEST: zephyr board-only change (drop before review) diff --git a/tests/basics/int1.py b/tests/basics/int1.py index b9920f1b4af..94723af4d00 100644 --- a/tests/basics/int1.py +++ b/tests/basics/int1.py @@ -103,5 +103,3 @@ def test(value, base): int([]) except TypeError: print("TypeError") - -# TEST: tests-only change (drop before review)