Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 1 addition & 11 deletions tools/ci_fetch_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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)
58 changes: 29 additions & 29 deletions tools/ci_set_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -110,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(
Expand Down Expand Up @@ -384,25 +382,25 @@ def set_zephyr_tests(run: bool):
set_output("zephyr-tests", run)


def set_windows(run: bool):
# 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:
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
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 windows:", run)
set_output("windows", run)
print("Building mpy-cross:", run)
set_output("mpy-cross", run)


def main():
Expand All @@ -411,7 +409,9 @@ def main():
# Set jobs
set_docs(run_all)
set_zephyr_tests(run_all)
set_windows(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_boards(run_all)


Expand Down
Loading