-
Notifications
You must be signed in to change notification settings - Fork 12
144 lines (118 loc) · 3.45 KB
/
test.yml
File metadata and controls
144 lines (118 loc) · 3.45 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
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-integration:
name: Unit & Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run tests
run: bun run test
working-directory: tests
- name: Run tests with coverage
run: bun run test:coverage
working-directory: tests
- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
directory: tests/coverage
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
e2e:
name: E2E Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Install Playwright browsers
run: bunx playwright install --with-deps chromium
working-directory: tests
- name: Build application
run: bun run build
working-directory: apps/web
env:
DATABASE_URL: file:./test.db
DATABASE_AUTH_TOKEN: ''
BETTER_AUTH_SECRET: test-secret-for-ci-at-least-32-chars
RESEND_API_KEY: ''
ALLOW_SIGNIN_SIGNUP: 'true'
NEXT_PUBLIC_APP_URL: http://localhost:3000
- name: Setup test database
run: bunx drizzle-kit push
working-directory: packages/db
env:
DATABASE_URL: file:../../apps/web/test.db
DATABASE_AUTH_TOKEN: ''
SKIP_ENV_VALIDATION: 'true'
- name: Seed E2E test data
run: bun run e2e/seed.ts
working-directory: tests
env:
DATABASE_URL: file:../apps/web/test.db
DATABASE_AUTH_TOKEN: ''
BETTER_AUTH_SECRET: test-secret-for-ci-at-least-32-chars
ALLOW_SIGNIN_SIGNUP: 'true'
NEXT_PUBLIC_APP_URL: http://localhost:3000
- name: Start application
run: |
bun run start &
sleep 10
working-directory: apps/web
env:
DATABASE_URL: file:./test.db
DATABASE_AUTH_TOKEN: ''
BETTER_AUTH_SECRET: test-secret-for-ci-at-least-32-chars
RESEND_API_KEY: ''
ALLOW_SIGNIN_SIGNUP: 'true'
NEXT_PUBLIC_APP_URL: http://localhost:3000
PORT: 3000
- name: Run E2E tests
run: bun run test:e2e
working-directory: tests
env:
BASE_URL: http://localhost:3000
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: tests/playwright-report/
retention-days: 7
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run lint
run: bun run lint
- name: Run type check
run: bun run typecheck