-
Notifications
You must be signed in to change notification settings - Fork 17
116 lines (101 loc) · 4.04 KB
/
Copy pathtest.yml
File metadata and controls
116 lines (101 loc) · 4.04 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
name: CI Pipeline
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node22-modules-${{ hashFiles('package-lock.json') }}-${{ hashFiles('prisma/schema.prisma') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Run unit tests
env:
TEST_SUITE: unit
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: test-secret
JWT_SECRET: test-jwt-secret
DATABASE_URL: postgresql://localhost:5432/hive_test_unit
run: npm run test:unit
integration-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: hive_user
POSTGRES_PASSWORD: hive_password
POSTGRES_DB: hive_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node22-modules-${{ hashFiles('package-lock.json') }}-${{ hashFiles('prisma/schema.prisma') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Run Prisma migrations
env:
DATABASE_URL: postgresql://hive_user:hive_password@localhost:5432/hive_db
DIRECT_URL: postgresql://hive_user:hive_password@localhost:5432/hive_db
run: npx prisma migrate deploy
- name: Run integration tests
env:
TEST_SUITE: integration
DATABASE_URL: postgresql://hive_user:hive_password@localhost:5432/hive_db
DIRECT_URL: postgresql://hive_user:hive_password@localhost:5432/hive_db
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
GITHUB_CLIENT_ID: ${{ secrets.GITHUB_CLIENT_ID }}
GITHUB_CLIENT_SECRET: ${{ secrets.GITHUB_CLIENT_SECRET }}
TOKEN_ENCRYPTION_KEY: ${{ secrets.TOKEN_ENCRYPTION_KEY }}
STAKWORK_API_KEY: ${{ secrets.STAKWORK_API_KEY }}
STAKWORK_BASE_URL: https://jobs.stakwork.com/api/v1
POOL_MANAGER_API_KEY: ${{ secrets.POOL_MANAGER_API_KEY }}
POOL_MANAGER_BASE_URL: https://workspaces.sphinx.chat/api
SWARM_SUPERADMIN_API_KEY: ${{ secrets.SWARM_SUPERADMIN_API_KEY }}
POOL_MANAGER_API_USERNAME: ${{ secrets.POOL_MANAGER_API_USERNAME }}
POOL_MANAGER_API_PASSWORD: ${{ secrets.POOL_MANAGER_API_PASSWORD }}
STAKWORK_CUSTOMERS_EMAIL: ${{ secrets.STAKWORK_CUSTOMERS_EMAIL}}
STAKWORK_CUSTOMERS_PASSWORD: ${{ secrets.STAKWORK_CUSTOMERS_PASSWORD}}
SWARM_SUPER_ADMIN_URL: placeholder
LIVEKIT_CALL_BASE_URL: "https://call-link"
# The integration suite runs all ~260 files in a single VM thread
# (vitest `pool: "vmThreads", singleThread: true` — kept that way so
# the Prisma library engine initializes once; see vitest.config.ts),
# so heap grows monotonically across the run. A recent run OOM'd at
# file 255/261, just short of finishing. Bump the worker heap to give
# headroom (runner has 16GB). If this recurs, shard the suite instead.
run: NODE_OPTIONS="--max-old-space-size=6144" npm run test:integration