Merge pull request #7642 from MicroDev1/ci

CI: Fix scheduler
This commit is contained in:
Scott Shawcroft 2023-02-24 12:30:39 -08:00 committed by GitHub
commit 2c843403ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 18 deletions

View File

@ -93,7 +93,6 @@ jobs:
tests: tests:
needs: scheduler needs: scheduler
if: needs.scheduler.outputs.build-boards == 'True'
uses: ./.github/workflows/run-tests.yml uses: ./.github/workflows/run-tests.yml
with: with:
cp-version: ${{ needs.scheduler.outputs.cp-version }} cp-version: ${{ needs.scheduler.outputs.cp-version }}
@ -109,7 +108,7 @@ jobs:
mpy-cross-mac: mpy-cross-mac:
runs-on: macos-11 runs-on: macos-11
needs: scheduler needs: scheduler
if: ${{ needs.scheduler.outputs.build-boards == 'True' }} if: needs.scheduler.outputs.build-boards == 'True'
env: env:
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }} CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
steps: steps:
@ -164,7 +163,7 @@ jobs:
build-doc: build-doc:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: scheduler needs: scheduler
if: ${{ needs.scheduler.outputs.build-doc == 'True' }} if: needs.scheduler.outputs.build-doc == 'True'
env: env:
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }} CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
steps: steps:
@ -222,7 +221,7 @@ jobs:
build-windows: build-windows:
runs-on: windows-2022 runs-on: windows-2022
needs: scheduler needs: scheduler
if: ${{ needs.scheduler.outputs.build-windows == 'True' }} if: needs.scheduler.outputs.build-windows == 'True'
env: env:
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }} CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
defaults: defaults:

View File

@ -42,7 +42,7 @@ from shared_bindings_matrix import (
all_ports_all_boards, all_ports_all_boards,
) )
PORT_TO_ARCH = { PORT_TO_JOB = {
"atmel-samd": "atmel", "atmel-samd": "atmel",
"broadcom": "aarch", "broadcom": "aarch",
"cxd56": "arm", "cxd56": "arm",
@ -110,7 +110,7 @@ def set_output(name: str, value):
def set_boards_to_build(build_all: bool): def set_boards_to_build(build_all: bool):
if last_failed_jobs.get("mpy_cross") or last_failed_jobs.get("tests"): if last_failed_jobs.get("mpy-cross") or last_failed_jobs.get("tests"):
build_all = True build_all = True
# Get boards in json format # Get boards in json format
@ -224,33 +224,32 @@ def set_boards_to_build(build_all: bool):
boards_to_build = all_board_ids boards_to_build = all_board_ids
break break
# Split boards by architecture. # Split boards by job
arch_to_boards = {"aarch": [], "arm": [], "atmel": [], "esp": [], "riscv": []} job_to_boards = {"aarch": [], "arm": [], "atmel": [], "esp": [], "riscv": []}
# Append previously failed boards # Append previously failed boards
for arch in arch_to_boards: for job in job_to_boards:
if arch in last_failed_jobs: if job in last_failed_jobs:
for board in last_failed_jobs[arch]: for board in last_failed_jobs[job]:
if not board in boards_to_build: boards_to_build.add(board)
boards_to_build.append(board)
build_boards = bool(boards_to_build) build_boards = bool(boards_to_build)
print("Building boards:", build_boards) print("Building boards:", build_boards)
set_output("build-boards", build_boards) set_output("build-boards", build_boards)
# Append boards according to arch # Append boards according to job
for board in sorted(boards_to_build): for board in sorted(boards_to_build):
port = board_to_port.get(board) port = board_to_port.get(board)
# A board can appear due to its _deletion_ (rare) # A board can appear due to its _deletion_ (rare)
# if this happens it's not in `board_to_port`. # if this happens it's not in `board_to_port`.
if not port: if not port:
continue continue
arch_to_boards[PORT_TO_ARCH[port]].append(board) job_to_boards[PORT_TO_JOB[port]].append(board)
print(" ", board) print(" ", board)
# Set the step outputs for each architecture # Set the step outputs for each job
for arch in arch_to_boards: for job in job_to_boards:
set_output(f"boards-{arch}", json.dumps(arch_to_boards[arch])) set_output(f"boards-{job}", json.dumps(job_to_boards[job]))
def set_docs_to_build(build_doc: bool): def set_docs_to_build(build_doc: bool):