generated from toakiryu/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (60 loc) · 1.8 KB
/
nextjs-package-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Test Scratch Auth Next.js Package
on:
push:
paths:
- "packages/nextjs/**"
pull_request:
paths:
- "packages/nextjs/**"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
SCRATCH_AUTH_SECRET_KEY: ${{ secrets.SCRATCH_AUTH_SECRET_KEY }}
NEXT_PUBLIC_REDIRECT_URL: "http://localhost:3000/api/auth"
services:
scratch-auth:
image: scratch-auth/scratch-auth:latest
ports:
- 4000:4000
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install dependencies for nextjs package
working-directory: packages/nextjs
run: npm install
- name: Link nextjs package
run: |
npm link
cd ../test/nextjs
npm link nextjs
- name: Install dependencies for test package
working-directory: test/nextjs
run: npm install
- name: Run build for nextjs package
working-directory: packages/nextjs
run: npm run build
- name: Start the Next.js application
working-directory: packages/nextjs
run: npm run dev &
- name: Wait for server to be ready
run: npx wait-on http://localhost:3000
- name: Run authentication test
run: |
curl -X POST http://localhost:3000/api/auth -d "privateCode=test"
echo "Testing authentication successful"
- name: Stop services
run: |
kill $(lsof -t -i:3000) || true
if: always()
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: nextjs-scratch-auth-test-results
path: packages/nextjs/test-results