forked from VoltAgent/voltagent
-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (209 loc) · 6.91 KB
/
pull-request.yml
File metadata and controls
227 lines (209 loc) · 6.91 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: PR Checks
on: [pull_request]
jobs:
commit-lint:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-commit-lint
cancel-in-progress: true
name: Commitlint
steps:
- uses: actions/checkout@v4
- uses: wagoid/commitlint-github-action@v5
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22, 24]
concurrency:
group: ${{ github.ref }}-lint-${{ matrix.node-version }}
cancel-in-progress: true
name: Lint (Node ${{ matrix.node-version }})
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install Dependencies
run: |
pnpm install -w
env:
NODE_OPTIONS: "--max-old-space-size=8192"
- name: Lint with Biome
run: |
pnpm lint:ci
- name: Syncpack
run: pnpm sp lint
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22, 24]
concurrency:
group: ${{ github.ref }}-pr-build-${{ matrix.node-version }}
cancel-in-progress: true
name: Build (Node ${{ matrix.node-version }})
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install
run: pnpm install
env:
NODE_OPTIONS: "--max-old-space-size=8192"
- name: Build
run: pnpm build:all
- name: Publint
run: pnpm publint:all
# - name: Are The Types Wrong
# run: pnpm attw:all
test-packages:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- cli
- core
- create-voltagent-app
- docs-mcp
- internal
- logger
- postgres
- supabase
- voice
- server-core
- libsql
fail-fast: false
concurrency:
group: ${{ github.ref }}-test-${{ matrix.package }}
cancel-in-progress: true
name: Test ${{ matrix.package }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install Dependencies
run: pnpm install
env:
NODE_OPTIONS: "--max-old-space-size=8192"
- name: Set package scope
id: scope
run: |
if [[ "${{ matrix.package }}" == "create-voltagent-app" ]]; then
echo "scope=create-voltagent-app" >> $GITHUB_OUTPUT
else
echo "scope=@voltagent/${{ matrix.package }}" >> $GITHUB_OUTPUT
fi
- name: Build Package and Dependencies
run: lerna run build --scope "${{ steps.scope.outputs.scope }}" --include-dependencies
- name: Test Package
run: lerna run test --scope "${{ steps.scope.outputs.scope }}"
postgres-integration:
runs-on: ubuntu-latest
name: PostgreSQL Integration Tests
concurrency:
group: ${{ github.ref }}-postgres-integration
cancel-in-progress: true
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: voltagent_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for PostgreSQL changes
id: check_postgres
run: |
if git diff --name-only origin/main...HEAD | grep -E '^packages/postgres/'; then
echo "postgres_changed=true" >> $GITHUB_OUTPUT
else
echo "postgres_changed=false" >> $GITHUB_OUTPUT
fi
- name: Skip if no PostgreSQL changes
if: steps.check_postgres.outputs.postgres_changed == 'false'
run: echo "No PostgreSQL changes detected, skipping integration tests"
- uses: pnpm/action-setup@v4
if: steps.check_postgres.outputs.postgres_changed == 'true'
- uses: actions/setup-node@v4
if: steps.check_postgres.outputs.postgres_changed == 'true'
with:
node-version: 20
cache: "pnpm"
- name: Install Dependencies
if: steps.check_postgres.outputs.postgres_changed == 'true'
run: pnpm install
env:
NODE_OPTIONS: "--max-old-space-size=8192"
- name: Build Core Dependencies
if: steps.check_postgres.outputs.postgres_changed == 'true'
run: pnpm build --scope @voltagent/core
- name: Run PostgreSQL Integration Tests
if: steps.check_postgres.outputs.postgres_changed == 'true'
run: |
cd packages/postgres
npm run test:integration:ci
env:
DATABASE_URL: postgresql://test:test@localhost:5432/voltagent_test
e2e-tests:
runs-on: ubuntu-latest
name: E2E Tests
concurrency:
group: ${{ github.ref }}-e2e-tests
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for E2E-related changes
id: check_e2e
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
if ! git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null; then
git fetch origin "${{ github.event.pull_request.base.ref }}" --depth=1
BASE_SHA="origin/${{ github.event.pull_request.base.ref }}"
fi
if git diff --name-only "$BASE_SHA"...HEAD | grep -E '^(\.github/workflows/pull-request\.yml|packages/e2e/|packages/core/|packages/libsql/|packages/postgres/|packages/internal/|packages/logger/|package\.json|pnpm-lock\.yaml)'; then
echo "e2e_changed=true" >> $GITHUB_OUTPUT
else
echo "e2e_changed=false" >> $GITHUB_OUTPUT
fi
- name: Skip if no E2E-related changes
if: steps.check_e2e.outputs.e2e_changed == 'false'
run: echo "No E2E-related changes detected, skipping E2E tests"
- uses: pnpm/action-setup@v4
if: steps.check_e2e.outputs.e2e_changed == 'true'
- uses: actions/setup-node@v4
if: steps.check_e2e.outputs.e2e_changed == 'true'
with:
node-version: 20
cache: "pnpm"
- name: Install Dependencies
if: steps.check_e2e.outputs.e2e_changed == 'true'
run: pnpm install
env:
NODE_OPTIONS: "--max-old-space-size=8192"
- name: Build E2E Dependencies
if: steps.check_e2e.outputs.e2e_changed == 'true'
run: pnpm lerna run build --scope @voltagent/e2e --include-dependencies
- name: Run E2E Tests
if: steps.check_e2e.outputs.e2e_changed == 'true'
run: pnpm --filter @voltagent/e2e test