-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CI: Schedule PR jobs based on commit specific changes #7132
Conversation
To test locally: (Guide to get REPO=adafruit/circuitpython PULL=7132 GITHUB_TOKEN=*** EXCLUDE_COMMIT=30f07fbf22bfb7e19e27f062d1ab39ab83e7b067 python tools/ci_changes_per_commit.py |
So, if I understand correctly, the idea is that a new commit to a PR would run only jobs that failed due to the previous commit(s)? Suppose the new commit broke builds that passed in the previous commits? Or would the new commit still trigger a rebuild of all the affected builds based on the scope of some file change? |
The jobs will be run based on the changed files between new commit and the most recent commit with a workflow run plus the jobs that failed in the previous workflow run will also be added if not already present. |
I'm removing myself as a reviewer. Thanks for taking into account my comment on the basic idea. But at least right this second I'm not able to think too hard about the specifics of this proposed change. |
@microdev1 I think I will merge this after beta.4. I didn't see anything to change, but it's complicated, s let's test the workflow in action after the next release. |
@dhalbert Still want this in? I'm concerned we'll miss broken but not fixed issues. |
I do not understand this well enough to have an opinion right now. |
@tannewt Can you elaborate on "we'll miss broken but not fixed issues". |
If commit A is run and fails on boards 1 and 2 then commit B is added to fix 2 (but not 1), then the CI view will show green even though 1 is still broken. I think you need to run tests based on all changes since the main branch. |
This won't be the case as failed jobs from the most recent workflow run of the PR are also scheduled. |
Ah, ok. Neat! I'm ok merging this in now. |
The goal here was to schedule PR jobs based on file changes specific to a commit instead of diff between
base
andhead
branch of the PR, this presented two (that I know of) pitfalls:head
commit and the most recent commit with a workflow run.Process Flow:
GraphQL
API.workflow == "Build CI" and conclusion != "Success"
.checkSuite
ID of the commit is then used to fetch the unsuccessfulcheckRuns
.tj-actions/changed-files
is used to get changed files based on diff betweenhead
commit and the most recent commit with a workflow run. If no commit with a workflow run was found, the comparison is betweenbase
andhead
commit.set-matrix
job which schedules the PR jobs.