forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
257 lines (220 loc) · 9.51 KB
/
Copy pathci.yml
File metadata and controls
257 lines (220 loc) · 9.51 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: CI
on:
pull_request:
permissions:
actions: read
contents: read
jobs:
lint:
runs-on: ubuntu-latest
if: github.repository == 'activepieces/activepieces'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- run: bun install
- name: Turbo Cache
uses: rharkor/caching-for-turbo@v2.4.2
with:
provider: s3
s3-bucket: ${{ secrets.TURBO_CACHE_S3_BUCKET }}
s3-region: auto
s3-endpoint: ${{ secrets.TURBO_CACHE_S3_ENDPOINT }}
s3-access-key-id: ${{ secrets.TURBO_CACHE_S3_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.TURBO_CACHE_S3_SECRET_ACCESS_KEY }}
max-age: 3w
max-size: 20gb
- name: Check if framework or common pieces are changed
id: check-framework-common
run: |
CHANGED_FILES="$(git diff --name-only HEAD origin/main | tr '\n' ' ')"
if echo "$CHANGED_FILES" | grep -q "pieces/framework\|pieces/common"; then
echo "framework_or_common_changed=true" >> $GITHUB_OUTPUT
else
echo "framework_or_common_changed=false" >> $GITHUB_OUTPUT
fi
- name: Lint core projects
run: npm run lint-core
- name: Lint all pieces projects
if: steps.check-framework-common.outputs.framework_or_common_changed == 'true'
run: npm run lint-pieces
main:
runs-on: ubuntu-latest
if: github.repository == 'activepieces/activepieces'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- run: bun install
- name: Turbo Cache
uses: rharkor/caching-for-turbo@v2.4.2
with:
provider: s3
s3-bucket: ${{ secrets.TURBO_CACHE_S3_BUCKET }}
s3-region: auto
s3-endpoint: ${{ secrets.TURBO_CACHE_S3_ENDPOINT }}
s3-access-key-id: ${{ secrets.TURBO_CACHE_S3_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.TURBO_CACHE_S3_SECRET_ACCESS_KEY }}
max-age: 3w
max-size: 20gb
- name: Get changed files
id: changed-files
run: echo "files=$(git diff --name-only HEAD origin/main | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Check if framework or common pieces are changed
id: check-framework-common
run: |
CHANGED_FILES="${{ steps.changed-files.outputs.files }}"
if echo "$CHANGED_FILES" | grep -q "pieces/framework\|pieces/common"; then
echo "framework_or_common_changed=true" >> $GITHUB_OUTPUT
else
echo "framework_or_common_changed=false" >> $GITHUB_OUTPUT
fi
- name: Extract pieces package names from changed files
id: extract-pieces
run: |
PIECES=$(echo "${{ steps.changed-files.outputs.files }}" | grep -oE "packages/pieces/(community|core)/[^/]+" | awk -F'/' '{print $NF}' | sort -u | tr '\n' ',' | sed 's/,$//')
if [ -n "$PIECES" ]; then
FILTERS=$(echo "$PIECES" | tr ',' '\n' | sed 's/.*/{&}/' | tr '\n' ',' | sed 's/,$//')
echo "pieces_filters=$FILTERS" >> $GITHUB_OUTPUT
else
echo "pieces_filters=" >> $GITHUB_OUTPUT
fi
- name: Build core projects
run: npx turbo run build --filter=web --filter=worker --filter=api --filter=@activepieces/engine --filter=@activepieces/piece-http --filter=@activepieces/piece-data-mapper --filter=@activepieces/piece-approval --filter=@activepieces/piece-webhook --filter=@activepieces/piece-delay
- name: Build changed pieces projects
if: steps.extract-pieces.outputs.pieces_filters != '' && steps.check-framework-common.outputs.framework_or_common_changed == 'false'
run: |
IFS=',' read -ra PIECES <<< "${{ steps.extract-pieces.outputs.pieces_filters }}"
FILTER_ARGS=""
for piece in "${PIECES[@]}"; do
piece_name=$(echo "$piece" | tr -d '{}')
if [ -f "packages/pieces/community/${piece_name}/package.json" ] || [ -f "packages/pieces/core/${piece_name}/package.json" ]; then
FILTER_ARGS="$FILTER_ARGS --filter=@activepieces/piece-${piece_name}"
fi
done
if [ -n "$FILTER_ARGS" ]; then
npx turbo run build $FILTER_ARGS
fi
- name: Build all pieces projects
if: steps.check-framework-common.outputs.framework_or_common_changed == 'true'
run: npx turbo run build --filter='@activepieces/piece-*'
- name: Run all tests and migration checks in parallel
run: |
set -euo pipefail
pids=()
npx turbo run test --filter=@activepieces/engine --filter=@activepieces/shared --filter=@activepieces/sandbox --filter=@activepieces/ai-providers --filter=@activepieces/core-execution --filter=@activepieces/pieces-framework --filter=web --filter=worker &
pids+=($!)
npx turbo run test-ce test-ee test-cloud check-migrations --filter=api &
pids+=($!)
npx tsx tools/scripts/check-migration-rollback.ts &
pids+=($!)
status=0
for pid in "${pids[@]}"; do
if ! wait "$pid"; then
status=1
fi
done
exit $status
# Runs ONLY the tool-search integration tests against a real PostgreSQL + pgvector
# service container. The default `main` job above runs these on PGLITE, which papers
# over node-postgres-specific driver behaviour (e.g. TypeORM `.query()` returning
# `[rows, count]` instead of a plain rows array). This job exists to catch that class
# of bug. It is intentionally scoped and additive — it does NOT change how the main
# suite runs.
tool-search-postgres:
name: tool-search (postgres)
runs-on: ubuntu-latest
if: github.repository == 'activepieces/activepieces'
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: activepieces
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
# dotenv (vitest.setup.ts) loads .env.tests WITHOUT overriding values already
# present in the environment, so these job-level vars win over the PGLITE defaults.
AP_DB_TYPE: POSTGRES
AP_POSTGRES_HOST: localhost
AP_POSTGRES_PORT: "5432"
AP_POSTGRES_DATABASE: activepieces
AP_POSTGRES_USERNAME: postgres
AP_POSTGRES_PASSWORD: postgres
AP_POSTGRES_USE_SSL: "false"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- run: bun install
- name: Turbo Cache
uses: rharkor/caching-for-turbo@v2.4.2
with:
provider: s3
s3-bucket: ${{ secrets.TURBO_CACHE_S3_BUCKET }}
s3-region: auto
s3-endpoint: ${{ secrets.TURBO_CACHE_S3_ENDPOINT }}
s3-access-key-id: ${{ secrets.TURBO_CACHE_S3_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.TURBO_CACHE_S3_SECRET_ACCESS_KEY }}
max-age: 3w
max-size: 20gb
- name: Enable pgvector extension
# The pgvector image ships the extension binary but does not auto-create it in the
# database. The tool_search_index migration skips table creation when `vector` is
# absent, and the DB-only test never boots the server path that would CREATE it,
# so create it explicitly before migrations run.
run: |
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d activepieces \
-c 'CREATE EXTENSION IF NOT EXISTS vector;'
- name: Build api
run: npx turbo run build --filter=api
- name: Run tool-search integration tests on Postgres
working-directory: packages/server/api
# --no-file-parallelism: these files all point at the one shared `activepieces`
# service DB and each runs migrations on `DataSource.initialize()`. Vitest's default
# forked parallelism runs those migration passes concurrently, which collide on
# shared catalog objects (the migrations table, en_natural collation, added columns)
# and fail non-deterministically. Serial execution migrates once; later files skip
# via the migrations table. (PGLITE gives each file its own DB, so the default suite
# is unaffected — only this shared-Postgres job needs serializing.)
run: npx vitest run test/integration/ce/tool-search --bail 1 --passWithNoTests=false --no-file-parallelism