Skip to content

Commit

Permalink
Merge pull request #746 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
marcoieni authored Oct 31, 2024
2 parents e34a1d7 + 5ec1223 commit 44b84e5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
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) }}'

0 comments on commit 44b84e5

Please sign in to comment.