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

Switch CI from bors to merge queue #746

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 17 additions & 28 deletions .github/workflows/bors.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: bors build
name: CI
on:
push:
branches:
- try
- auto
merge_group:

jobs:
lint:
Expand Down Expand Up @@ -122,29 +119,21 @@ jobs:
aws_secret_access_key: "${{ secrets.aws_secret_access_key }}"
if: github.ref == 'refs/heads/auto'


# 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 NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

end-success:
name: bors build finished
if: success()
runs-on: ubuntu-latest
conclusion:
needs: [docker-upload]

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

end-failure:
name: bors build finished
if: "!success()"
# 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: [docker-upload]

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) }}'
21 changes: 21 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,24 @@ jobs:
run: |
cargo run -- create-lists
cargo test

# Note: this job is used so that there is a job named "conclusion" both in the PR and merge queue
# CI. Otherwise, it would not be possible for PR CI to succeed.
conclusion:
needs: [lint, test]
# 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) }}'
22 changes: 1 addition & 21 deletions tests/minicrater/full/full.html.context.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
0,
{
"RootResults": {
"count": 4,
"count": 3,
"results": {
"build ICE": [
{
Expand Down Expand Up @@ -57,26 +57,6 @@
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"
}
],
"build compiler-error(E0658)": [
{
"color_idx": 0,
"name": "error-code (local)",
"res": "regressed",
"runs": [
{
"color_idx": 7,
"log": "stable/local/error-code",
"name_idx": 0
},
{
"color_idx": 0,
"log": "beta/local/error-code",
"name_idx": 2
}
],
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"
}
],
"build failed (unknown)": [
{
"color_idx": 0,
Expand Down
22 changes: 1 addition & 21 deletions tests/minicrater/full/index.html.context.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
0,
{
"RootResults": {
"count": 4,
"count": 3,
"results": {
"build ICE": [
{
Expand Down Expand Up @@ -57,26 +57,6 @@
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"
}
],
"build compiler-error(E0658)": [
{
"color_idx": 0,
"name": "error-code (local)",
"res": "regressed",
"runs": [
{
"color_idx": 7,
"log": "stable/local/error-code",
"name_idx": 0
},
{
"color_idx": 0,
"log": "beta/local/error-code",
"name_idx": 2
}
],
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"
}
],
"build failed (unknown)": [
{
"color_idx": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/minicrater/full/markdown.md.context.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
{
"log": "beta/local/error-code",
"res": "build-fail:compiler-error(E0015, E0658)"
"res": "build-fail:compiler-error(E0015)"
}
],
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"
Expand Down
2 changes: 1 addition & 1 deletion tests/minicrater/full/results.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
},
{
"log": "beta/local/error-code",
"res": "build-fail:compiler-error(E0015, E0658)"
"res": "build-fail:compiler-error(E0015)"
}
],
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/error-code"
Expand Down