Skip to content

Commit

Permalink
Merge pull request #1063 from godot-rust/feature/merge-queues
Browse files Browse the repository at this point in the history
Migrate from bors to GitHub merge queues
  • Loading branch information
Bromeon authored Nov 22, 2023
2 parents c19b0ea + 6674e4d commit 5fe1caa
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 39 deletions.
3 changes: 0 additions & 3 deletions .github/bors.toml

This file was deleted.

28 changes: 15 additions & 13 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Complete CI workflow
# Run by bors, and enforced before any PR is merged
# Run by GitHub merge queues, and enforced before any PR is merged
# Includes unit and integration tests for all platforms, as well as optional nightly jobs

# See also: https://matklad.github.io/2021/09/04/fast-rust-builds.html
Expand Down Expand Up @@ -33,10 +33,7 @@ env:
CARGO_MACHETE_VERSION: "0.3"

on:
push:
branches:
- staging
- trying
merge_group:

defaults:
run:
Expand Down Expand Up @@ -330,23 +327,28 @@ jobs:
godot_ver: ${{ matrix.godot }}


# This job doesn't actually test anything, but is used to tell bors that the build completed,
# as there is no practical way to detect when a workflow is successful, listening to webhooks only.
# The ID (not name) of this job is the one referenced in bors.toml.
# Job to notify merge queue about success/failure. Named the same as the one in minimal-ci.
# It is always run, even on failure, to not wait until timeouts happen.
#
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
full-ci:
if: github.event_name == 'push' && success()
ci-status:
# Check for 'merge_group' not strictly necessary, but helpful when adding add-hoc `push:` trigger to `on:` for testing branch.
if: always() && github.event_name == 'merge_group'
needs:
#- rustfmt
- rustfmt
- clippy
- cargo-deny-machete
- test
- integration-test-godot
- build-release
- build-ios
- build-android
- integration-test-godot
runs-on: ubuntu-latest
steps:
- name: "Mark the job as a success"
- name: "Success"
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0

- name: "Failure"
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
35 changes: 22 additions & 13 deletions .github/workflows/minimal-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,25 @@ jobs:
with:
godot_ver: ${{ env.GODOT_VER }}

# Not really needed, since bors is not involved. Just needs an extra runner and makes the tests run longer.

# ci-success:
# if: success()
# needs:
# - rustfmt
# - clippy
# - unit-test
# - integration-test-godot
# runs-on: ubuntu-latest
# steps:
# - name: Mark the job as a success
# run: exit 0

# ---------------------------------------------------------------------------------------------------------------------------------------------
# CI status report

# Job to notify merge queue about success/failure. Named the same as the one in full-ci.
ci-status:
if: always()
needs:
- rustfmt
- clippy
- check-todo
- unit-test
- integration-test-godot
runs-on: ubuntu-latest
steps:
- name: "Success"
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0

- name: "Failure"
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
27 changes: 18 additions & 9 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
{
"op": "put",
"repo": "gdnative",
"repo-owner": "${{ github.repository_owner }}",
"num": "master",
"commit-sha": "${{ github.sha }}",
"date": "${{ github.event.head_commit.timestamp }}"
Expand All @@ -52,18 +53,25 @@ jobs:
# Opened/reopened/updated PR: include PR author + title
- name: "Construct JSON (for PR sync)"
if: github.event_name == 'pull_request' && github.event.action != 'closed'
# jq escapes backticks, double quotes etc. in PR title.
run: |
payload=$(cat <<'HEREDOC'
{
payload=$(jq -n \
--arg repoOwner '${{ github.repository_owner }}' \
--arg num '${{ github.event.number }}' \
--arg commitSha '${{ github.event.pull_request.head.sha }}' \
--arg date '${{ github.event.pull_request.updated_at }}' \
--arg prAuthor '${{ github.event.pull_request.user.login }}' \
--arg prTitle '${{ github.event.pull_request.title }}' \
'{
"op": "put",
"repo": "gdnative",
"num": "${{ github.event.number }}",
"commit-sha": "${{ github.event.pull_request.head.sha }}",
"date": "${{ github.event.pull_request.updated_at }}",
"pr-author": "${{ github.event.pull_request.user.login }}",
"pr-title": "${{ github.event.pull_request.title }}"
}
HEREDOC)
"repo-owner": $repoOwner,
"num": $num,
"commit-sha": $commitSha,
"date": $date,
"pr-author": $prAuthor,
"pr-title": $prTitle
}')
echo "VAR=$payload"
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
echo "${payload}" >> $GITHUB_ENV
Expand All @@ -77,6 +85,7 @@ jobs:
{
"op": "delete",
"repo": "gdnative",
"repo-owner": "${{ github.repository_owner }}",
"num": "${{ github.event.number }}",
"date": "${{ github.event.pull_request.updated_at }}"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/godot_tps_controller_port/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rust-version = "1.67"
license = "MIT"

[dependencies]
gdnative = { path = "../../gdnative" , features = ["formatted"] }
gdnative = { path = "../../gdnative", features = ["formatted"] }

[lib]
crate-type = ["cdylib"]

0 comments on commit 5fe1caa

Please sign in to comment.