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

chore: rerun CI only when full-ci label is added or removed #4136

Merged
merged 10 commits into from
May 13, 2024

Conversation

nomeata
Copy link
Contributor

@nomeata nomeata commented May 11, 2024

Previously, the CI would run upon every label addition, including things like builds-mathlib
or will-merge-soon, possibly triggering a new PR release, new mathlib builds etc. Very wasteful!

Unfortunately (but not surprisingly) Github does not offer a nice way of saying
“this workflow depends on that label, please re-run if changed”. Not enough
functional programmer or nix enthusiasts there, I guess…

So here is the next iteration trying to work with what we have from Github:

A new workflow watches for (only) full-ci label addition or deletion, and then re-runs
the CI job for the current PR.

Sounds simple? But remember, this is github!

  • github.event.pull_request.labels.*.name is not updated when a job is re-run.

    (This is actually a reasonable step towards determinism, but doesn't help us
    constructing this work-around.)

    Ok, so let’s use the API to fetch the current state of the label.

  • There is no good way to say “find the latest run of workflow "CI" on PR $n”.

    The best approximation seems to search by branch and triggering event. This can
    probably go wrong if there are multiple PRs from different repos with the same
    head ref name (patch-1 anyone?). Let’s hope that it doesn’t happen too often.

  • You cannot just rerun a workflow. You can only rerun a finished workflow. So cancel
    it first. And sleep a bit…

So let’s see how well this will work. It’s plausibly an improvement.

@nomeata nomeata added the awaiting-review Waiting for someone to review the PR label May 11, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc May 11, 2024 14:01 Inactive
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 11, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries CI can not be attempted yet, as the nightly-testing-2024-05-11 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Batteries CI should run now. (2024-05-11 14:16:50)

@nomeata nomeata added this pull request to the merge queue May 13, 2024
@nomeata nomeata removed the awaiting-review Waiting for someone to review the PR label May 13, 2024
Merged via the queue into master with commit d833f82 May 13, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants