Skip to content

Commit

Permalink
chore(ci): Add newer examples to required checks (#299)
Browse files Browse the repository at this point in the history
This adds our newer examples to the CI matrix and required checks.
  • Loading branch information
blaine-arcjet authored Mar 4, 2024
1 parent deaecaa commit 43e61d2
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 50 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/reusable-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,132 @@ jobs:
working-directory: examples/nextjs-14-app-dir-validate-email
run: npm run build

nextjs-14-clerk-rl:
name: Next.js 14 + Clerk + Rate Limit
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# Environment security
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
fonts.googleapis.com:443
fonts.gstatic.com:443
github.com:443
registry.npmjs.org:443
# 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-clerk-rl
run: npm ci

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

nextjs-14-clerk-shield:
name: Next.js 14 + Clerk + Shield
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# Environment security
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
fonts.googleapis.com:443
fonts.gstatic.com:443
github.com:443
registry.npmjs.org:443
# 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-clerk-shield
run: npm ci

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

nextjs-14-decorate:
name: Next.js 14 + Decorate
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# Environment security
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
fonts.googleapis.com:443
fonts.gstatic.com:443
github.com:443
registry.npmjs.org:443
# 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-decorate
run: npm ci

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

nextjs-14-openai:
name: Next.js 14 + OpenAI
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@ merge:
# - Build examples / Next.js 13 + Page Router + withArcjet
- Build examples / Next.js 14 + App Router + Rate Limit
- Build examples / Next.js 14 + App Router + Validate Email
- Build examples / Next.js 14 + Clerk + Rate Limit
- Build examples / Next.js 14 + Clerk + Shield
- Build examples / Next.js 14 + Decorate
- Build examples / Next.js 14 + OpenAI
- Build examples / Next.js 14 + Page Router + withArcjet
4 changes: 2 additions & 2 deletions examples/nextjs-14-clerk-rl/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export default function Home() {
</ol>

<pre>
curl -v http://localhost:3000/api/arcjet -H "Authorization: Bearer
TOKENHERE"
curl -v http://localhost:3000/api/arcjet -H &quot;Authorization: Bearer
TOKENHERE&quot;
</pre>
</div>
</main>
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-14-clerk-rl/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { authMiddleware } from "@clerk/nextjs";

export default authMiddleware({
// Routes that can be accessed while signed out
publicRoutes: ["/", '/api/public'],
apiRoutes: ["/api/private"],
});

export const config = {
// Protects all routes, including api/trpc.
// See https://clerk.com/docs/references/nextjs/auth-middleware
Expand Down
90 changes: 45 additions & 45 deletions examples/nextjs-14-clerk-shield/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/nextjs-14-clerk-shield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@arcjet/next": "file:../../arcjet-next",
"@clerk/nextjs": "^4.29.9",
"next": "14.1.0",
"next": "14.1.1",
"react": "^18",
"react-dom": "^18"
},
Expand Down

0 comments on commit 43e61d2

Please sign in to comment.