Skip to content

Commit 932b10f

Browse files
authored
Merge pull request #7627 from MicroDev1/ci
Re-enable changes per commit
2 parents c7d9eec + dc80133 commit 932b10f

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,16 @@ jobs:
5454
uses: ./.github/actions/deps/external
5555
with:
5656
action: cache
57-
# Disabled: Needs to be updated
58-
# - name: Get last commit with checks
59-
# id: get-last-commit-with-checks
60-
# if: github.event_name == 'pull_request'
61-
# working-directory: tools
62-
# run: python3 -u ci_changes_per_commit.py
63-
# env:
64-
# REPO: ${{ github.repository }}
65-
# PULL: ${{ github.event.number }}
66-
# GITHUB_TOKEN: ${{ github.token }}
67-
# EXCLUDE_COMMIT: ${{ github.event.after }}
57+
- name: Get last commit with checks
58+
id: get-last-commit-with-checks
59+
if: github.event_name == 'pull_request'
60+
working-directory: tools
61+
run: python3 -u ci_changes_per_commit.py
62+
env:
63+
REPO: ${{ github.repository }}
64+
PULL: ${{ github.event.number }}
65+
GITHUB_TOKEN: ${{ github.token }}
66+
EXCLUDE_COMMIT: ${{ github.event.after }}
6867
- name: Set up mpy-cross
6968
uses: ./.github/actions/mpy_cross
7069
with:

tools/ci_changes_per_commit.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,26 +166,14 @@ def get_commit_depth_and_check_suite(query_commits):
166166
return [None, None]
167167

168168

169-
def append_runs_to_list(runs, bad_runs_by_matrix):
170-
regex_matrix = re.compile("^build-[^ ]+")
171-
regex_board = re.compile("\([^ ]+\)$")
172-
for run in runs["nodes"]:
173-
name = run["name"]
174-
res_matrix = regex_matrix.search(name)
175-
if res_matrix:
176-
matrix = res_matrix.group()
177-
if matrix not in bad_runs_by_matrix:
178-
bad_runs_by_matrix[matrix] = []
179-
res_board = regex_board.search(name)
180-
if res_board:
181-
bad_runs_by_matrix[matrix].append(res_board.group()[1:-1])
182-
183-
184169
def get_bad_check_runs(query_check_runs):
185170
more_pages = True
186171
bad_runs_by_matrix = {}
172+
187173
run_types = ["failed", "incomplete"]
188174

175+
regex_matrix = re.compile("^[^\n ]+ \/ (build|run) \([^\n ]+\)$")
176+
189177
while more_pages:
190178
check_runs = query_check_runs.fetch()["data"]["node"]
191179
more_pages = False
@@ -194,7 +182,17 @@ def get_bad_check_runs(query_check_runs):
194182
run_type_camel = run_type.capitalize() + "Run"
195183
run_type = run_type + "Runs"
196184

197-
append_runs_to_list(check_runs[run_type], bad_runs_by_matrix)
185+
for check_run in check_runs[run_type]["nodes"]:
186+
name = check_run["name"]
187+
res_matrix = regex_matrix.search(name)
188+
if res_matrix:
189+
matrix = name.split(" /", 1)[0]
190+
matrix_job = name.split(" (", 1)[1][:-1]
191+
bad_runs_by_matrix.setdefault(matrix, []).append(matrix_job)
192+
elif name != "scheduler":
193+
bad_runs_by_matrix[name] = True
194+
else:
195+
return {}
198196

199197
if query_check_runs.paginate(
200198
check_runs[run_type]["pageInfo"], "after" + run_type_camel

tools/ci_set_matrix.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def set_output(name: str, value):
9292

9393

9494
def set_boards_to_build(build_all: bool):
95+
if "mpy_cross" in last_failed_jobs or "tests" in last_failed_jobs:
96+
build_all = True
97+
9598
# Get boards in json format
9699
boards_info_json = build_board_info.get_board_mapping()
97100
all_board_ids = set()

0 commit comments

Comments
 (0)