Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable changes per commit #7627

Merged
merged 1 commit into from
Feb 22, 2023
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
21 changes: 10 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,16 @@ jobs:
uses: ./.github/actions/deps/external
with:
action: cache
# Disabled: Needs to be updated
# - name: Get last commit with checks
# id: get-last-commit-with-checks
# if: github.event_name == 'pull_request'
# working-directory: tools
# run: python3 -u ci_changes_per_commit.py
# env:
# REPO: ${{ github.repository }}
# PULL: ${{ github.event.number }}
# GITHUB_TOKEN: ${{ github.token }}
# EXCLUDE_COMMIT: ${{ github.event.after }}
- name: Get last commit with checks
id: get-last-commit-with-checks
if: github.event_name == 'pull_request'
working-directory: tools
run: python3 -u ci_changes_per_commit.py
env:
REPO: ${{ github.repository }}
PULL: ${{ github.event.number }}
GITHUB_TOKEN: ${{ github.token }}
EXCLUDE_COMMIT: ${{ github.event.after }}
- name: Set up mpy-cross
uses: ./.github/actions/mpy_cross
with:
Expand Down
30 changes: 14 additions & 16 deletions tools/ci_changes_per_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,14 @@ def get_commit_depth_and_check_suite(query_commits):
return [None, None]


def append_runs_to_list(runs, bad_runs_by_matrix):
regex_matrix = re.compile("^build-[^ ]+")
regex_board = re.compile("\([^ ]+\)$")
for run in runs["nodes"]:
name = run["name"]
res_matrix = regex_matrix.search(name)
if res_matrix:
matrix = res_matrix.group()
if matrix not in bad_runs_by_matrix:
bad_runs_by_matrix[matrix] = []
res_board = regex_board.search(name)
if res_board:
bad_runs_by_matrix[matrix].append(res_board.group()[1:-1])


def get_bad_check_runs(query_check_runs):
more_pages = True
bad_runs_by_matrix = {}

run_types = ["failed", "incomplete"]

regex_matrix = re.compile("^[^\n ]+ \/ (build|run) \([^\n ]+\)$")

while more_pages:
check_runs = query_check_runs.fetch()["data"]["node"]
more_pages = False
Expand All @@ -194,7 +182,17 @@ def get_bad_check_runs(query_check_runs):
run_type_camel = run_type.capitalize() + "Run"
run_type = run_type + "Runs"

append_runs_to_list(check_runs[run_type], bad_runs_by_matrix)
for check_run in check_runs[run_type]["nodes"]:
name = check_run["name"]
res_matrix = regex_matrix.search(name)
if res_matrix:
matrix = name.split(" /", 1)[0]
matrix_job = name.split(" (", 1)[1][:-1]
bad_runs_by_matrix.setdefault(matrix, []).append(matrix_job)
elif name != "scheduler":
bad_runs_by_matrix[name] = True
else:
return {}

if query_check_runs.paginate(
check_runs[run_type]["pageInfo"], "after" + run_type_camel
Expand Down
3 changes: 3 additions & 0 deletions tools/ci_set_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def set_output(name: str, value):


def set_boards_to_build(build_all: bool):
if "mpy_cross" in last_failed_jobs or "tests" in last_failed_jobs:
build_all = True

# Get boards in json format
boards_info_json = build_board_info.get_board_mapping()
all_board_ids = set()
Expand Down