Skip to content

Commit

Permalink
ci: Add merge queue workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
blaine-arcjet committed Jan 10, 2024
1 parent 29b1a2e commit 4e9e0d2
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 22 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/merge-queue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Merge Queue

on:
# We use Trunk Merge Queues so we use this `push` event instead of the
# `merge_queue` event, as per
# https://docs.trunk.io/merge/set-up-trunk-merge#configure-merge-requirements
push:
branches:
- trunk-merge/**

jobs:
test:
name: Run tests
uses: ./.github/workflows/reusable-test.yml

examples:
name: Build examples
uses: ./.github/workflows/reusable-examples.yml
19 changes: 19 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Pull Request

on:
pull_request:
# Recommended by Graphite: https://graphite.dev/docs/github-configuration-guidelines#github-actions
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Run tests
uses: ./.github/workflows/reusable-test.yml

examples:
name: Build examples
uses: ./.github/workflows/reusable-examples.yml
22 changes: 17 additions & 5 deletions .github/workflows/release.yml → .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
name: "Create release"
name: Push

on:
push:
# Only ever run `push` events against protected branches, likely just `main`
branches:
- main

# Release Please creates a Pull Request with changes to files
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Run tests
uses: ./.github/workflows/reusable-test.yml

examples:
name: Build examples
uses: ./.github/workflows/reusable-examples.yml

release:
runs-on: ubuntu-latest
# Release Please is very fast, so we set a tiny timeout
timeout-minutes: 1
# Release Please creates a Pull Request with changes to files
permissions:
contents: write
pull-requests: write
steps:
- name: Release Please
uses: google-github-actions/release-please-action@a2d8d683f209466ee8c695cd994ae2cf08b1642d
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: "Build examples"
# Our reusable workflow files only use the `workflow_call` event and don't
# specify a `concurrency` limit so those things can be managed by the caller.
name: Reusable examples workflow

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: [workflow_call]

jobs:
nextjs-13-pages-wrap:
name: "Next.js 13 + Page Router + withArcjet"
name: Next.js 13 + Page Router + withArcjet
runs-on: ubuntu-latest
steps:
# Environment security
Expand Down Expand Up @@ -42,7 +40,7 @@ jobs:
run: npm run build

nextjs-14-app-dir-rl:
name: "Next.js 14 + App Router + Rate Limit"
name: Next.js 14 + App Router + Rate Limit
runs-on: ubuntu-latest
steps:
# Environment security
Expand Down Expand Up @@ -76,7 +74,7 @@ jobs:
run: npm run build

nextjs-14-app-dir-validate-email:
name: "Next.js 14 + App Router + Validate Email"
name: Next.js 14 + App Router + Validate Email
runs-on: ubuntu-latest
steps:
# Environment security
Expand Down Expand Up @@ -110,7 +108,7 @@ jobs:
run: npm run build

nextjs-14-openai:
name: "Next.js 14 + OpenAI"
name: Next.js 14 + OpenAI
runs-on: ubuntu-latest
steps:
# Environment security
Expand Down Expand Up @@ -144,7 +142,7 @@ jobs:
run: npm run build

nextjs-14-pages-wrap:
name: "Next.js 14 + Page Router + withArcjet"
name: Next.js 14 + Page Router + withArcjet
runs-on: ubuntu-latest
steps:
# Environment security
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: "Run tests"
# Our reusable workflow files only use the `workflow_call` event and don't
# specify a `concurrency` limit so those things can be managed by the caller.
name: Reusable test workflow

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: [workflow_call]

jobs:
test:
Expand Down
4 changes: 4 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ actions:
- trunk-check-pre-push
- trunk-announce
- trunk-upgrade-available
merge:
required_statuses:
- Run tests
- Build examples

0 comments on commit 4e9e0d2

Please sign in to comment.