-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit add CI jobs to set up GitHub Merge Queues. Merge queues ensure builds are always green before landing on `trunk`, and allow multiple PRs to be tested and merged in sequence, reducing overall CI time. chore: Enable GitHub Merge Queues.
- Loading branch information
1 parent
b7bdb6a
commit ba0b6d4
Showing
3 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: "On Merge | Validate Build" | ||
|
||
on: | ||
# Use a merge queue to gate the creation and storage | ||
# of these Docker images. | ||
merge_group: | ||
# Allow this job to be executed manually from the GH UI. | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
pr-ready: | ||
if: always() | ||
name: "⚡ PR Ready" | ||
runs-on: ubuntu-latest | ||
needs: | ||
- "build" | ||
steps: | ||
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | ||
run: | | ||
echo "One or more dependent jobs failed, was skipped, or was cancelled. All jobs must pass for the PR to be ready." | ||
exit 1 | ||
- run: echo "OK" | ||
|
||
# TODO: Exfiltrate this job into one or more action/jobs so it can be reused | ||
# for on-pr and on-merge. | ||
# This job installs Cargo Make and Cargo Nextest before running | ||
# the CI workflow using Cargo Make. Most of the time, it should | ||
# restore Cargo Make and other dependencies from cache. | ||
build: | ||
name: Validate Rust Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Install Rust (Nightly)" | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: rustfmt,clippy | ||
|
||
- name: "Install Rust (Stable)" | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: llvm-tools-preview,rustfmt,clippy | ||
|
||
- name: "Restore Rust Cache" | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: "Install Cargo Tools from Binaries." | ||
uses: "taiki-e/install-action@v2" | ||
with: | ||
tool: "cargo-tarpaulin,cargo-make,cargo-nextest,cargo-llvm-cov" | ||
|
||
- name: "Install Cargo Sort" | ||
uses: taiki-e/cache-cargo-install-action@v1 | ||
with: | ||
tool: cargo-sort | ||
|
||
- name: "Install Taplo CLI" | ||
uses: taiki-e/cache-cargo-install-action@v1 | ||
with: | ||
tool: taplo-cli | ||
|
||
- name: "Cargo Make" | ||
run: cargo make ci-flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: "On PR | Validate Build" | ||
on: | ||
# When a PR is initiated, we want to validate the PR before running | ||
# the merge queue. | ||
pull_request: | ||
# Allow this job to be executed manually from the GH UI. | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
# Do not change this job's name without also changing "pr-ready"'s | ||
# job name in "on-merge.yml". These jobs must have the same name. | ||
# See the README for more details. | ||
pr-ready: | ||
if: always() | ||
name: "⚡ PR Ready" | ||
runs-on: ubuntu-latest | ||
needs: | ||
- "build" | ||
steps: | ||
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | ||
run: | | ||
echo "One or more dependent jobs failed, was skipped, or was cancelled. All jobs must pass for the PR to be ready." | ||
exit 1 | ||
- run: echo "OK" | ||
|
||
# TODO: Exfiltrate this job into one or more action/jobs so it can be reused | ||
# for on-pr and on-merge. | ||
build: | ||
name: Validate Rust Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Install Rust (Nightly)" | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: rustfmt,clippy | ||
|
||
- name: "Install Rust (Stable)" | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: llvm-tools-preview,rustfmt,clippy | ||
|
||
- name: "Restore Rust Cache" | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: "Install Cargo Tools from Binaries." | ||
uses: "taiki-e/install-action@v2" | ||
with: | ||
tool: "cargo-tarpaulin,cargo-make,cargo-nextest,cargo-llvm-cov" | ||
|
||
- name: "Install Cargo Sort" | ||
uses: taiki-e/cache-cargo-install-action@v1 | ||
with: | ||
tool: cargo-sort | ||
|
||
- name: "Install Taplo CLI" | ||
uses: taiki-e/cache-cargo-install-action@v1 | ||
with: | ||
tool: taplo-cli | ||
|
||
- name: "Cargo Make" | ||
run: cargo make ci-flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters