-
Notifications
You must be signed in to change notification settings - Fork 189
167 lines (159 loc) · 5.57 KB
/
Copy pathci.yml
File metadata and controls
167 lines (159 loc) · 5.57 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
name: CI
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
- ".github/FUNDING.yml"
pull_request:
branches: [main, staging]
paths-ignore:
- "**.md"
- "docs/**"
- ".github/FUNDING.yml"
permissions:
contents: read
concurrency:
group: ci-${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run lint
typecheck:
name: Check Types
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run --cwd apps/docs postinstall
- run: bun run check-types
test:
name: Test
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/databuddy_test
REDIS_URL: redis://localhost:6379
REDIS_HOST: localhost
REDIS_PORT: 6379
REDPANDA_BROKER: localhost:9092
REDPANDA_USER: test-redpanda-user
REDPANDA_PASSWORD: test-redpanda-password
DATABUDDY_API_KEY: test-databuddy-api-key
DATABUDDY_WEBSITE_ID: test-databuddy-website-id
BETTER_AUTH_SECRET: test-auth-secret-for-ci-testing-only
BETTER_AUTH_URL: http://localhost:3000
GITHUB_CLIENT_ID: test-github-client-id
GITHUB_CLIENT_SECRET: test-github-client-secret
GOOGLE_CLIENT_ID: test-google-client-id
GOOGLE_CLIENT_SECRET: test-google-client-secret
RESEND_API_KEY: test-resend-api-key
RECAPTCHA_SECRET_KEY: test-recaptcha-secret-key
VERCEL_CLIENT_ID: test-vercel-client-id
VERCEL_CLIENT_SECRET: test-vercel-client-secret
AUTUMN_SECRET_KEY: test-autumn-secret-key
NEXT_PUBLIC_API_URL: http://localhost:3000/api
EMAIL_API_KEY: test-email-api-key
IP_HASH_SALT: test-ip-hash-salt
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: databuddy_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
clickhouse:
image: clickhouse/clickhouse-server:25.5.1-alpine
env:
CLICKHOUSE_DB: databuddy_analytics
CLICKHOUSE_USER: default
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
ports:
- 8123:8123
options: >-
--health-cmd "clickhouse-client --query 'SELECT 1'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 2
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: ${{ runner.os }}-turbo-
- run: bun install --frozen-lockfile --ignore-scripts
- name: Push test schema
run: cd packages/db && bunx drizzle-kit push
- name: Init ClickHouse schema
env:
CLICKHOUSE_URL: http://default:@localhost:8123
run: bun run --cwd packages/db clickhouse:init
- name: Test
env:
NODE_ENV: test
run: bun run test
- name: Insights integration
env:
NODE_ENV: test
INSIGHTS_INTEGRATION_TESTS: "true"
BULLMQ_REDIS_URL: redis://localhost:6379/4
run: bun run --cwd apps/insights test:integration
- name: Uptime router integration
env:
NODE_ENV: test
UPTIME_ROUTER_INTEGRATION: "true"
BULLMQ_REDIS_URL: redis://localhost:6379/3
run: cd apps/api && bun test src/integration/uptime-handlers.test.ts