-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (155 loc) · 4.32 KB
/
ci.yml
File metadata and controls
181 lines (155 loc) · 4.32 KB
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
181
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
type-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run type-check
unit-tests:
name: Unit Tests (${{ matrix.locale }})
runs-on: ubuntu-latest
strategy:
matrix:
locale: ["en", "pl"]
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MONGODB_URI: mongodb://localhost:27017/cognito-test
TEST_LOCALE: ${{ matrix.locale }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test -- --run
build:
name: Build Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
e2e-tests:
name: E2E Tests (${{ matrix.locale }} - ${{ matrix.browser }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
locale: ["en", "pl"]
browser: ["Mobile Chrome", "Desktop Chrome"]
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
weaviate:
image: semitechnologies/weaviate:1.34.4
ports:
- 8080:8080
- 50051:50051
env:
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "false"
AUTHENTICATION_APIKEY_ENABLED: "true"
AUTHENTICATION_APIKEY_ALLOWED_KEYS: "e2e-test-key"
AUTHENTICATION_APIKEY_USERS: "e2e-test-user"
PERSISTENCE_DATA_PATH: "/var/lib/weaviate"
QUERY_DEFAULTS_LIMIT: "1000"
CLUSTER_HOSTNAME: "node1"
env:
MONGODB_URI: mongodb://localhost:27017/cognito-e2e
WEAVIATE_HTTP_HOST: localhost
WEAVIATE_HTTP_PORT: 8080
WEAVIATE_GRPC_HOST: localhost
WEAVIATE_GRPC_PORT: 50051
WEAVIATE_SECURE: false
WEAVIATE_API_KEY: e2e-test-key
NEXTAUTH_SECRET: e2e-test-secret-key-change-in-production
NEXTAUTH_URL: http://localhost:2137
TEST_SERVER_URL: http://localhost:2137
TEST_LOCALE: ${{ matrix.locale }}
NODE_ENV: production
PORT: 2137
AUTH_TRUST_HOST: http://localhost:3000
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci --include=dev
- name: Build project
run: npm run build
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run E2E tests
run: npm run test:e2e -- --project='${{ matrix.browser }}'
- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.locale }}-${{ matrix.browser }}
path: playwright-report/
retention-days: 7