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

Use merge queue #399

Merged
merged 1 commit into from
May 13, 2024
Merged
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
44 changes: 40 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: CI

on:
pull_request:
merge_group:

push:
branches:
- master
pull_request:

# smoelius: Every Thursday at 3:00 UTC (Wednesday at 22:00 EST), run `cargo test -- --ignored`.
schedule:
Expand All @@ -21,7 +19,41 @@ env:
CARGO_TERM_COLOR: always

jobs:
maybe-expedite:
outputs:
value: ${{ steps.expedite.outputs.value }}

runs-on: ubuntu-latest

steps:
- name: Log github refs
run: |
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo 'github.ref: ${{ github.ref }}' >> "$GITHUB_STEP_SUMMARY"
echo 'github.sha: ${{ github.sha }}' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if merging an up-to-date branch
if: ${{ github.event_name == 'merge_group' }}
id: expedite
run: |
N="$(expr "${{ github.ref }}" : '.*-\([0-9]\+\)-[^-]*$')"
BASE_SHA="$(gh api /repos/${{ github.repository }}/pulls/"$N" | jq -r '.base.sha')"
if git diff --quiet ${{ github.event.merge_group.base_sha }} "$BASE_SHA"; then
echo "value=1" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ github.token }}

lint:
needs: [maybe-expedite]

if: ${{ ! needs.maybe-expedite.outputs.value }}

runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -99,6 +131,10 @@ jobs:
cargo clean && cargo +nightly udeps --all-targets

test:
needs: [maybe-expedite]

if: ${{ ! needs.maybe-expedite.outputs.value }}

runs-on: ubuntu-latest

strategy:
Expand Down