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 9, 2024
1 parent 6f28934 commit aa1f223
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 210 deletions.
185 changes: 13 additions & 172 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,178 +1,19 @@
name: "Build examples"

on: [push, pull_request]
name: Build examples

on:
# We cannot filter by path as this is a required check. See
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
push:
branches:
- main
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:
nextjs-13-pages-wrap:
name: "Next.js 13 + Page Router + withArcjet"
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-13-pages-wrap
run: npm ci

- name: Build
working-directory: examples/nextjs-13-pages-wrap
run: npm run build

nextjs-14-app-dir-rl:
name: "Next.js 14 + App Router + Rate Limit"
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-app-dir-rl
run: npm ci

- name: Build
working-directory: examples/nextjs-14-app-dir-rl
run: npm run build

nextjs-14-app-dir-validate-email:
name: "Next.js 14 + App Router + Validate Email"
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-app-dir-validate-email
run: npm ci

- name: Build
working-directory: examples/nextjs-14-app-dir-validate-email
run: npm run build

nextjs-14-openai:
name: "Next.js 14 + OpenAI"
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-openai
run: npm ci

- name: Build
working-directory: examples/nextjs-14-openai
run: npm run build

nextjs-14-pages-wrap:
name: "Next.js 14 + Page Router + withArcjet"
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-pages-wrap
run: npm ci

- name: Build
working-directory: examples/nextjs-14-pages-wrap
run: npm run build
examples:
uses: ./.github/workflows/reusable-examples.yml
15 changes: 15 additions & 0 deletions .github/workflows/merge-queue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Merge queue

on:
push:
branches:
- trunk-merge/**

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

examples:
name: Merge queue - Build examples
uses: ./.github/workflows/reusable-examples.yml
176 changes: 176 additions & 0 deletions .github/workflows/reusable-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# 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: [workflow_call]

jobs:
nextjs-13-pages-wrap:
name: "Next.js 13 + Page Router + withArcjet"

Check failure on line 9 in .github/workflows/reusable-examples.yml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-13-pages-wrap
run: npm ci

- name: Build
working-directory: examples/nextjs-13-pages-wrap
run: npm run build

nextjs-14-app-dir-rl:
name: "Next.js 14 + App Router + Rate Limit"

Check failure on line 43 in .github/workflows/reusable-examples.yml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-app-dir-rl
run: npm ci

- name: Build
working-directory: examples/nextjs-14-app-dir-rl
run: npm run build

nextjs-14-app-dir-validate-email:
name: "Next.js 14 + App Router + Validate Email"

Check failure on line 77 in .github/workflows/reusable-examples.yml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-app-dir-validate-email
run: npm ci

- name: Build
working-directory: examples/nextjs-14-app-dir-validate-email
run: npm run build

nextjs-14-openai:
name: "Next.js 14 + OpenAI"

Check failure on line 111 in .github/workflows/reusable-examples.yml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-openai
run: npm ci

- name: Build
working-directory: examples/nextjs-14-openai
run: npm run build

nextjs-14-pages-wrap:
name: "Next.js 14 + Page Router + withArcjet"

Check failure on line 145 in .github/workflows/reusable-examples.yml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
runs-on: ubuntu-latest
steps:
# Environment security
- name: Step Security
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

# Checkout
# Most toolchains require checkout first
- name: Checkout
uses: actions/checkout@v4

# Language toolchains
- name: Install Node
uses: actions/setup-node@v4.0.0
with:
node-version: 20

# Workflow

- name: Install dependencies
run: npm ci

- name: Install example dependencies
working-directory: examples/nextjs-14-pages-wrap
run: npm ci

- name: Build
working-directory: examples/nextjs-14-pages-wrap
run: npm run build
Loading

0 comments on commit aa1f223

Please sign in to comment.