Skip to content

Commit

Permalink
reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
blaine-arcjet committed Jan 9, 2024
1 parent f522a83 commit 345d66b
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 212 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, workflow_call]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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
4 changes: 2 additions & 2 deletions .github/workflows/merge_queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
jobs:
test:
name: Merge queue - Run tests
uses: ./.github/workflows/test.yml
uses: ./.github/workflows/reusable/test.yml

examples:
name: Merge queue - Build examples
uses: ./.github/workflows/examples.yml
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"
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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 345d66b

Please sign in to comment.