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