Skip to content

Run Zephyr tests in their own workflow - #11294

Merged
tannewt merged 2 commits into
adafruit:mainfrom
mikeysklar:zephyr-tests-separate-workflow
Sep 2, 2026
Merged

Run Zephyr tests in their own workflow#11294
tannewt merged 2 commits into
adafruit:mainfrom
mikeysklar:zephyr-tests-separate-workflow

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

What

Zephyr tests move to their own workflow, out of the ports dependency chain.

Why

Board builds in every port waited on the Zephyr job, every PR.

# build.yml, before
ports:
  needs: [scheduler, mpy-cross, tests]
# tests = run-tests.yml = {run x4, zephyr}
# a called workflow is not complete until every job in it is
before:  tests{run x4, zephyr} ─> ports{espressif, raspberrypi,
                                        atmel-samd, nordic, zephyr-cp}

after:   tests{run x4} ────────> ports{espressif, raspberrypi,
         zephyr-tests                  atmel-samd, nordic, zephyr-cp}
         (gates nothing)

# ports still needs tests, so the saving is the delta between the zephyr
# job and the slowest run leg, not the zephyr job's full duration

Changes

File Change
run-zephyr-tests.yml New. Holds the zephyr job, body byte-identical.
run-tests.yml Job removed. Now only run.
build.yml Calls zephyr-tests, absent from ports' needs.
tools/ci_set_matrix.py New workflow added to IGNORE_BOARD.
# ci_set_matrix.py: why the IGNORE_BOARD entry is not optional.
# Any .github file not listed there reaches this fall-through, so
# editing the new workflow would rebuild every board in the repo.
# run-tests.yml is already listed for exactly this reason.
            # Otherwise build it all
            boards_to_build = all_board_ids
            break

Needs a maintainer action

Branch protection lists required checks by name. This renames one.

Before After
tests / zephyr zephyr-tests / zephyr
# if the old name is required, the rename either blocks every PR on a
# check that never reports, or silently drops the requirement.
# I cannot see repo settings, so I cannot tell which.

Side effect of the rename

The rename also changes ci_changes_per_commit.py. Correct, but worth naming.

# tools/ci_changes_per_commit.py:181
    have_dependent_jobs = ["scheduler", "mpy-cross", "tests"]
...
                if any([name.startswith(job) for job in have_dependent_jobs]):
                    return {}

# `tests / zephyr` matched this prefix, so a failed Zephyr job disabled
# the resume-from-last-checked-commit optimization entirely.
# `zephyr-tests / zephyr` does not match. The result is discarded by
# ci_set_matrix.py, which reads only "ports" and "docs".
# Deliberately not added to have_dependent_jobs: nothing depends on the
# job, and it still runs on every PR, so no coverage is lost.

Why not gate the Zephyr job on changed files

It exercises core py/ and shared-*. Reordering is safe, skipping is not.

Trade-off

A red Zephyr job no longer stops board jobs from spending compute.

# the 4-way `run` matrix still gates ports. The Zephyr job is a weak
# canary for an espressif or atmel-samd build, and it cost every PR
# wall-clock time.

Hardware tested

None. Workflow change only.

How I tested it

pre-commit run --from-ref <base> --to-ref HEAD   # clean
python3 -c "import yaml, ..."                    # all three parse

# TODO: link this PR's run, board jobs starting while zephyr-tests runs
# TODO: zephyr and slowest run-leg durations, 3+ main runs, and the delta
# NOTE: this PR rebuilds every board, because it edits build.yml, which
#       is correctly not in IGNORE_BOARD. The new entry only affects
#       later edits to run-zephyr-tests.yml.

Scope

Job wiring only. The Zephyr job body is unchanged.

# two carried-over oddities left alone to keep the move byte-identical:
#   strategy: fail-fast: false   with no matrix
#   id: set-up-submodules        never referenced

Not in this PR:

  • Caching the west workspace in deps/ports/zephyr-cp, which caches
    nothing today.
  • Tiering the 29 Zephyr board builds: a subset on PRs, all on main.

AI assistance

Claude Code traced the dependency chain and wrote the diff.

The `ports` job depends on `tests`, and `tests` is the whole of
run-tests.yml, which contained both the VM test matrix and the Zephyr
job. A called workflow is not complete until every job in it is, so no
board in any port started building until the Zephyr job had finished its
west setup, built native_sim and bsim, and run the port's tests. That
happened on every pull request, including ones touching no Zephyr code.

Move the Zephyr job into run-zephyr-tests.yml and call it from build.yml
alongside `tests`, but deliberately not in `ports`' `needs`. The job body
is byte-identical and still runs on every pull request.

Two consequences worth naming, since the job body being unchanged does
not make them so:

The check run is now named `zephyr-tests / zephyr` rather than
`tests / zephyr`. Branch protection lists required checks by name, so it
needs updating if it names the old one.

That rename also changes ci_changes_per_commit.py, which prefix-matches
check names against have_dependent_jobs = ["scheduler", "mpy-cross",
"tests"]. A failed Zephyr job used to match and disable the resume-from-
last-checked-commit optimization entirely. It no longer matches, and the
result is discarded, which is correct now that nothing depends on it. It
is deliberately not added to that list.

Also add the new workflow to IGNORE_BOARD in ci_set_matrix.py, next to
run-tests.yml. Without it, editing the file falls through to the "build
it all" case and rebuilds every board in the repo.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment we don't need. Good otherwise. This sort of thing is better documented by git history than inline code comment.

Comment thread .github/workflows/build.yml Outdated
Per review: the reason belongs in git history, not an inline comment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@tannewt
tannewt merged commit 4f210d8 into adafruit:main Sep 2, 2026
682 checks passed
@mikeysklar

Copy link
Copy Markdown
Collaborator Author

Here we go!

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