Skip to content

Commit

Permalink
Merge pull request #13587 from Kobzol/ci-remove-bors
Browse files Browse the repository at this point in the history
Switch CI from bors to merge queue
  • Loading branch information
flip1995 authored Nov 7, 2024
2 parents ab560d8 + 843ef1b commit a28c44f
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 129 deletions.
50 changes: 17 additions & 33 deletions .github/workflows/clippy_dev.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
name: Clippy Dev Test

on:
push:
branches:
- auto
- try
merge_group:
pull_request:
# Only run on paths, that get checked by the clippy_dev tool
paths:
- 'CHANGELOG.md'
- 'README.md'
- '**.stderr'
- '**.rs'

env:
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -47,28 +38,21 @@ jobs:
cargo check
git reset --hard HEAD
# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
# workflow is successful listening to webhooks only.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

end-success:
name: bors dev test finished
if: github.event.pusher.name == 'bors' && success()
runs-on: ubuntu-latest
needs: [clippy_dev]

steps:
- name: Mark the job as successful
run: exit 0

end-failure:
name: bors dev test finished
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
conclusion_dev:
needs: [ clippy_dev ]
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
needs: [clippy_dev]

steps:
- name: Mark the job as a failure
run: exit 1
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Clippy Test (bors)
name: Clippy Test (merge queue)

on:
push:
branches:
- auto
- try
merge_group:

env:
RUST_BACKTRACE: 1
Expand All @@ -13,11 +10,6 @@ env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings

concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true

defaults:
run:
shell: bash
Expand Down Expand Up @@ -218,28 +210,21 @@ jobs:
env:
INTEGRATION: ${{ matrix.integration }}

# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
# workflow is successful listening to webhooks only.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

end-success:
name: bors test finished
if: github.event.pusher.name == 'bors' && success()
conclusion:
needs: [ changelog, base, metadata_collection, integration_build, integration ]
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
needs: [changelog, base, metadata_collection, integration_build, integration]

steps:
- name: Mark the job as successful
run: exit 0

end-failure:
name: bors test finished
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
runs-on: ubuntu-latest
needs: [changelog, base, metadata_collection, integration_build, integration]

steps:
- name: Mark the job as a failure
run: exit 1
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
40 changes: 22 additions & 18 deletions .github/workflows/clippy.yml → .github/workflows/clippy_pr.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
name: Clippy Test

on:
push:
# Ignore bors branches, since they are covered by `clippy_bors.yml`
branches-ignore:
- auto
- try
# Don't run Clippy tests, when only text files were modified
paths-ignore:
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'
pull_request:
# Don't run Clippy tests, when only text files were modified
paths-ignore:
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'

env:
RUST_BACKTRACE: 1
Expand All @@ -35,7 +18,7 @@ concurrency:

jobs:
base:
# NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml
# NOTE: If you modify this job, make sure you copy the changes to clippy_mq.yml
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -73,3 +56,24 @@ jobs:
run: .github/driver.sh
env:
OS: ${{ runner.os }}

# We need to have the "conclusion" job also on PR CI, to make it possible
# to add PRs to a merge queue.
conclusion:
needs: [ base ]
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
46 changes: 17 additions & 29 deletions .github/workflows/remark.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
name: Remark

on:
push:
branches:
- auto
- try
merge_group:
pull_request:
paths:
- '**.md'

jobs:
remark:
Expand Down Expand Up @@ -45,28 +40,21 @@ jobs:
- name: Build mdbook
run: mdbook build book

# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
# workflow is successful listening to webhooks only.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

end-success:
name: bors remark test finished
if: github.event.pusher.name == 'bors' && success()
runs-on: ubuntu-latest
needs: [remark]

steps:
- name: Mark the job as successful
run: exit 0

end-failure:
name: bors remark test finished
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
conclusion_remark:
needs: [ remark ]
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
needs: [remark]

steps:
- name: Mark the job as a failure
run: exit 1
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
16 changes: 1 addition & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ All contributors are expected to follow the [Rust Code of Conduct].
- [Rust Analyzer](#rust-analyzer)
- [How Clippy works](#how-clippy-works)
- [Issue and PR triage](#issue-and-pr-triage)
- [Bors and Homu](#bors-and-homu)
- [Contributions](#contributions)
- [License](#license)

Expand Down Expand Up @@ -213,26 +212,13 @@ We have prioritization labels and a sync-blocker label, which are described belo
Or rather: before the sync this should be addressed,
e.g. by removing a lint again, so it doesn't hit beta/stable.

## Bors and Homu

We use a bot powered by [Homu][homu] to help automate testing and landing of pull
requests in Clippy. The bot's username is @bors.

You can find the Clippy bors queue [here][homu_queue].

If you have @bors permissions, you can find an overview of the available
commands [here][homu_instructions].

[triage]: https://forge.rust-lang.org/release/triage-procedure.html
[l-crash]: https://github.com/rust-lang/rust-clippy/labels/L-crash
[l-bug]: https://github.com/rust-lang/rust-clippy/labels/L-bug
[p-low]: https://github.com/rust-lang/rust-clippy/labels/P-low
[p-medium]: https://github.com/rust-lang/rust-clippy/labels/P-medium
[p-high]: https://github.com/rust-lang/rust-clippy/labels/P-high
[l-sync-blocker]: https://github.com/rust-lang/rust-clippy/labels/L-sync-blocker
[homu]: https://github.com/rust-lang/homu
[homu_instructions]: https://bors.rust-lang.org/
[homu_queue]: https://bors.rust-lang.org/queue/clippy

## Contributions

Expand All @@ -244,7 +230,7 @@ All PRs should include a `changelog` entry with a short comment explaining the c
"what do you believe is important from an outsider's perspective?" Often, PRs are only related to a single property of a
lint, and then it's good to mention that one. Otherwise, it's better to include too much detail than too little.

Clippy's [changelog] is created from these comments. Every release, someone gets all commits from bors with a
Clippy's [changelog] is created from these comments. Every release, someone gets all merge commits with a
`changelog: XYZ` entry and combines them into the changelog. This is a manual process.

Examples:
Expand Down
1 change: 0 additions & 1 deletion book/src/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ book](../lints.md).
> - IDE setup
> - High level overview on how Clippy works
> - Triage procedure
> - Bors and Homu
[ast]: https://rustc-dev-guide.rust-lang.org/syntax-intro.html
[hir]: https://rustc-dev-guide.rust-lang.org/hir.html
Expand Down

0 comments on commit a28c44f

Please sign in to comment.