-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (71 loc) · 2 KB
/
test-api.yml
File metadata and controls
82 lines (71 loc) · 2 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
name: Test API
on:
push:
branches: [main, develop]
paths:
- 'api/**'
- 'shared/**'
- '.github/workflows/test-api.yml'
pull_request:
branches: [main, develop]
paths:
- 'api/**'
- 'shared/**'
- '.github/workflows/test-api.yml'
jobs:
test-api:
name: Test API and Business Logic
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run database migrations
run: pnpm --filter "./api" db:push
env:
DATABASE_URL: postgresql://test:test@localhost:5432/test_db
continue-on-error: true
- name: Run API tests
run: pnpm --filter "./api" test
env:
CI: true
DATABASE_URL: postgresql://test:test@localhost:5432/test_db
NODE_ENV: test
AUTH0_DOMAIN: test-domain.auth0.com
AUTH0_AUDIENCE: test-audience
- name: Generate coverage report
run: pnpm --filter "./api" test:coverage
env:
DATABASE_URL: postgresql://test:test@localhost:5432/test_db
NODE_ENV: test
continue-on-error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./api/coverage/lcov.info
flags: api
name: api-coverage
continue-on-error: true