From ac5f1331e4b8375878259f9f57821a161a22c942 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Wed, 22 Nov 2023 21:01:18 +0100 Subject: [PATCH 1/2] Migrate from bors to GitHub merge queues --- .github/bors.toml | 3 --- .github/workflows/full-ci.yml | 28 +++++++++++++------------ .github/workflows/minimal-ci.yml | 35 ++++++++++++++++++++------------ 3 files changed, 37 insertions(+), 29 deletions(-) delete mode 100644 .github/bors.toml diff --git a/.github/bors.toml b/.github/bors.toml deleted file mode 100644 index b539fe794..000000000 --- a/.github/bors.toml +++ /dev/null @@ -1,3 +0,0 @@ -block_labels = ["status: postponed", "status: wontfix"] -delete_merged_branches = true -status = ["full-ci"] diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml index 303d89e4a..a2a06838e 100644 --- a/.github/workflows/full-ci.yml +++ b/.github/workflows/full-ci.yml @@ -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 @@ -33,10 +33,7 @@ env: CARGO_MACHETE_VERSION: "0.3" on: - push: - branches: - - staging - - trying + merge_group: defaults: run: @@ -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 diff --git a/.github/workflows/minimal-ci.yml b/.github/workflows/minimal-ci.yml index e56412406..02bc86638 100644 --- a/.github/workflows/minimal-ci.yml +++ b/.github/workflows/minimal-ci.yml @@ -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 From 6674e4d4215e14f27f5e5291c075feadd7870b20 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Wed, 22 Nov 2023 21:08:58 +0100 Subject: [PATCH 2/2] Doc sync improvements Escape PR titles using jq, add repo-owner (to avoid forks pushing docs) --- .github/workflows/update-docs.yml | 27 ++++++++++++------- examples/godot_tps_controller_port/Cargo.toml | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 1ad194f10..f45f906d9 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -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 }}" @@ -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<> $GITHUB_ENV echo "${payload}" >> $GITHUB_ENV @@ -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 }}" } diff --git a/examples/godot_tps_controller_port/Cargo.toml b/examples/godot_tps_controller_port/Cargo.toml index f250adb40..671895c81 100644 --- a/examples/godot_tps_controller_port/Cargo.toml +++ b/examples/godot_tps_controller_port/Cargo.toml @@ -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"]