-
Notifications
You must be signed in to change notification settings - Fork 259
180 lines (149 loc) · 4.7 KB
/
integration.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Integration Tests
on:
merge_group:
workflow_dispatch:
pull_request:
branches:
- master
push:
branches:
- master
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
env:
NODE_VERSION: 18
CACHE_KEY: '${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}'
DOMAIN: your-tenant.auth0.com
AUDIENCE: https://api.example.com/users
PORT: 3001
jobs:
build:
name: Prepare
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build package
uses: ./.github/actions/build
with:
node: ${{ env.NODE_VERSION }}
- name: Setup common dependencies
run: |
npm ci --prefix=examples/users-api
mv examples/users-api/.env.example examples/users-api/.env
- name: Save build artifacts
uses: actions/cache/save@v3
with:
path: .
key: ${{ env.CACHE_KEY }}
- name: Cache Cypress
uses: actions/cache/save@v3
with:
path: /home/runner/.cache/Cypress
key: ${{ env.CACHE_KEY }}-cypress
test-cra:
needs: build # Require build to complete before running tests
name: Run cra-react-router tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: .
key: ${{ env.CACHE_KEY }}
- name: Restore Cypress
uses: actions/cache/restore@v3
with:
path: /home/runner/.cache/Cypress
key: ${{ env.CACHE_KEY }}-cypress
- name: Run integration tests
run: |
npm ci
npm ci --prefix=examples/users-api
npm i --prefix=examples/cra-react-router --no-package-lock --legacy-peer-deps
mv examples/cra-react-router/.env.example examples/cra-react-router/.env
npm run test:cra
env:
SKIP_PREFLIGHT_CHECK: true
REACT_APP_DOMAIN: your-tenant.auth0.com
REACT_APP_CLIENT_ID: yourclientid
REACT_APP_AUDIENCE: https://api.example.com/users
REACT_APP_API_PORT: 3001
test-gatsby:
needs: build # Require build to complete before running tests
name: Run Gatsby tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: .
key: ${{ env.CACHE_KEY }}
- name: Restore Cypress
uses: actions/cache/restore@v3
with:
path: /home/runner/.cache/Cypress
key: ${{ env.CACHE_KEY }}-cypress
- name: Run integration tests
run: |
npm ci
npm ci --prefix=examples/users-api
npm i --prefix=examples/gatsby-app --no-package-lock --legacy-peer-deps
mv examples/gatsby-app/.env.example examples/gatsby-app/.env
npm run test:gatsby
env:
GATSBY_DOMAIN: your-tenant.auth0.com
GATSBY_CLIENT_ID: yourclientid
GATSBY_AUDIENCE: https://api.example.com/users
GATSBY_API_PORT: 3001
test-nextjs:
needs: build # Require build to complete before running tests
name: Run NextJS tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: .
key: ${{ env.CACHE_KEY }}
- name: Restore Cypress
uses: actions/cache/restore@v3
with:
path: /home/runner/.cache/Cypress
key: ${{ env.CACHE_KEY }}-cypress
- name: Run integration tests
run: |
npm ci
npm ci --prefix=examples/users-api
npm i --prefix=examples/nextjs-app --no-package-lock --legacy-peer-deps
mv examples/nextjs-app/.env.example examples/nextjs-app/.env
npm run test:nextjs
env:
NEXT_PUBLIC_DOMAIN: your-tenant.auth0.com
NEXT_PUBLIC_CLIENT_ID: yourclientid
NEXT_PUBLIC_AUDIENCE: https://api.example.com/users
NEXT_PUBLIC_API_PORT: 3001