Merge pull request #7704 from microdev1/ci
Conditionally run jobs on push
This commit is contained in:
commit
3c92f59915
|
@ -9,8 +9,6 @@ on:
|
|||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
check_suite:
|
||||
types: [rerequested]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
|
@ -64,24 +62,32 @@ jobs:
|
|||
PULL: ${{ github.event.number }}
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
EXCLUDE_COMMIT: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set head sha
|
||||
- name: Set head sha (pull)
|
||||
if: github.event_name == 'pull_request'
|
||||
run: echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
|
||||
- name: Set base sha
|
||||
- name: Set base sha (pull)
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
git fetch --no-tags --no-recurse-submodules --depth=$((DEPTH + 1)) origin $HEAD_SHA
|
||||
echo "BASE_SHA=$(git rev-list $HEAD_SHA --skip=$DEPTH --max-count=1)" >> $GITHUB_ENV
|
||||
env:
|
||||
DEPTH: ${{ steps.get-last-commit-with-checks.outputs.commit_depth || github.event.pull_request.commits }}
|
||||
- name: Set head sha (push)
|
||||
if: github.event_name == 'push'
|
||||
run: echo "HEAD_SHA=${{ github.event.after }}" >> $GITHUB_ENV
|
||||
- name: Set base sha (push)
|
||||
if: github.event_name == 'push'
|
||||
run: git cat-file -e $SHA && echo "BASE_SHA=$SHA" >> $GITHUB_ENV || true
|
||||
env:
|
||||
SHA: ${{ github.event.before }}
|
||||
- name: Get changes
|
||||
id: get-changes
|
||||
if: github.event_name == 'pull_request'
|
||||
if: env.BASE_SHA && env.HEAD_SHA
|
||||
run: echo $(git diff $BASE_SHA...$HEAD_SHA --name-only) | echo "changed_files=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT
|
||||
- name: Set matrix
|
||||
id: set-matrix
|
||||
working-directory: tools
|
||||
run: python3 -u ci_set_matrix.py
|
||||
working-directory: tools
|
||||
env:
|
||||
CHANGED_FILES: ${{ steps.get-changes.outputs.changed_files }}
|
||||
LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.check_runs }}
|
||||
|
|
|
@ -6,7 +6,7 @@ name: Update CircuitPython.org
|
|||
|
||||
on:
|
||||
release:
|
||||
types: [published, rerequested]
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
website:
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
name: pre-commit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
|
|
|
@ -171,8 +171,7 @@ def get_bad_check_runs(query_check_runs):
|
|||
more_pages = True
|
||||
|
||||
run_types = ["failed", "incomplete"]
|
||||
|
||||
regex_matrix = re.compile(r"^\S+ \/ (build|run) \(\S+\)$")
|
||||
have_dependent_jobs = ["scheduler", "mpy-cross", "tests"]
|
||||
|
||||
while more_pages:
|
||||
check_runs = query_check_runs.fetch()["data"]["node"]
|
||||
|
@ -184,15 +183,16 @@ def get_bad_check_runs(query_check_runs):
|
|||
|
||||
for check_run in check_runs[run_type]["nodes"]:
|
||||
name = check_run["name"]
|
||||
if name.startswith("ports") or regex_matrix.search(name):
|
||||
matrix = name.split(" ", 1)[0]
|
||||
matrix_job = name.rsplit(" (", 1)[1][:-1]
|
||||
bad_runs.setdefault(matrix, []).append(matrix_job)
|
||||
elif name != "scheduler":
|
||||
bad_runs[name] = True
|
||||
else:
|
||||
|
||||
if any([name.startswith(job) for job in have_dependent_jobs]):
|
||||
return {}
|
||||
|
||||
if name.startswith("ports"):
|
||||
matrix_job = name.rsplit(" (", 1)[1][:-1]
|
||||
bad_runs.setdefault("ports", []).append(matrix_job)
|
||||
else:
|
||||
bad_runs[name] = True
|
||||
|
||||
if query_check_runs.paginate(
|
||||
check_runs[run_type]["pageInfo"], "after" + run_type_camel
|
||||
):
|
||||
|
|
|
@ -98,9 +98,6 @@ def set_output(name: str, value):
|
|||
|
||||
|
||||
def set_boards(build_all: bool):
|
||||
if last_failed_jobs.get("mpy-cross") or last_failed_jobs.get("tests"):
|
||||
build_all = True
|
||||
|
||||
# Get boards in json format
|
||||
boards_info_json = build_board_info.get_board_mapping()
|
||||
all_board_ids = set()
|
||||
|
|
Loading…
Reference in New Issue