-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (84 loc) · 2.8 KB
/
Copy pathci.yml
File metadata and controls
105 lines (84 loc) · 2.8 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
name: CI
on:
push:
branches: [main, staging, production]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
# One run per ref; cancel superseded runs on the same branch/PR.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-typecheck:
name: Lint, typecheck & build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
with:
version: 10.28.2
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Build libraries
run: pnpm run build:libs
- name: Lint
run: pnpm run lint
- name: Typecheck
run: pnpm run typecheck
test:
name: Tests
runs-on: ubuntu-latest
# The API integration tests need a real Postgres. Matches the DATABASE_URL in
# apps/api/.env.example (postgres:postgres@localhost:5432/arkstark_test).
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: arkstark_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
with:
version: 10.28.2
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
# The libs are imported at runtime via their built `dist/`, so build them
# before running any package or API test.
- name: Build libraries
run: pnpm run build:libs
- name: Configure API test env
run: |
cp apps/api/.env.example apps/api/.env
# A deterministic 32-byte app key (JWT signing, 2FA encryption, sessions).
sed -i 's|^APP_KEY=.*$|APP_KEY=ci-test-app-key-0123456789abcdef|' apps/api/.env
- name: Run database migrations
working-directory: apps/api
run: pnpm ark migrate
- name: Run library & app tests
# Every @arkyc/* package except the API (run separately below). Filtering
# by the scope skips the unscoped root package, whose own `test` script
# would otherwise re-run recursively and double the `--pass-with-no-tests`.
run: pnpm --filter '@arkyc/*' --filter '!@arkyc/api' run test --pass-with-no-tests
- name: Run API tests
working-directory: apps/api
# Single-threaded: the suite shares one Postgres + app process, so file
# parallelism causes cross-test contention.
run: pnpm exec vitest run --no-file-parallelism