-
Notifications
You must be signed in to change notification settings - Fork 19
383 lines (368 loc) · 13.3 KB
/
Copy pathci.yaml
File metadata and controls
383 lines (368 loc) · 13.3 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
name: ci
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
contents: write
issues: read
checks: write
pull-requests: write
jobs:
unit:
name: test / unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- uses: ./.github/actions/install-tools
- name: test all
run: cargo test_all
timeout-minutes: 5
env:
RUST_BACKTRACE: full
RUST_LOG: debug
e2e:
name: test / e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- uses: ./.github/actions/install-tools
- name: test e2e
run: cargo test_e2e
timeout-minutes: 10
env:
RUST_BACKTRACE: full
RUST_LOG: debug
plugin_examples:
name: test / plugin examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- uses: ./.github/actions/install-tools
- name: test plugin examples
run: cargo test_plugin_examples
timeout-minutes: 10
working-directory: plugin_examples
env:
RUST_BACKTRACE: full
RUST_LOG: debug
node-addon-test:
name: test / node-addon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: build
run: npm run build:debug
working-directory: lib/node-addon
- name: test
working-directory: lib/node-addon
run: npm test
build:
name: check / build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- name: build
run: cargo build --release
fmt:
name: check / fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
components: rustfmt
- name: cargo fmt
uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1
clippy:
name: check / clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
components: clippy
- name: cargo clippy
run: cargo clippy --all
benchmark:
strategy:
matrix:
include:
- name: "graphql-tools"
package: "./lib/graphql-tools"
- name: "query-planner"
package: "./lib/query-planner"
- name: "executor"
package: "./lib/executor"
- name: "router"
package: "./bin/router"
name: benchmark / ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- if: matrix.name == 'executor'
name: Build subgraphs
run: cargo build --release -p subgraphs
- if: matrix.name == 'executor'
name: Run subgraphs
run: ./target/release/subgraphs & sleep 5
- name: Run benchmarks
run: cargo bench
working-directory: ${{ matrix.package }}
- name: Upload benchmark results
if: always() # Upload results even if benchmarks fail
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{matrix.package}}-benchmark-results
path: ${{matrix.package}}/target/criterion
router-benchmark:
strategy:
fail-fast: false
matrix:
include:
- name: "default"
args: ""
package: "hive-router"
binary: "hive_router"
config: "bench/configs/default.config.yaml"
compare_with_default: true
- name: "dedupe-inbound"
args: ""
package: "hive-router"
binary: "hive_router"
config: "bench/configs/dedupe-inbound.config.yaml"
compare_with_default: false
- name: "no-dedupe"
args: ""
package: "hive-router"
binary: "hive_router"
config: bench/configs/no-deduplication.config.yaml
compare_with_default: false
- name: "hive-tracing"
# turns otlp http/grpc to noop
args: "--features noop_otlp_exporter"
package: "hive-router"
binary: "hive_router"
config: bench/configs/hive-tracing.config.yaml
compare_with_default: false
- name: "otel"
# turns otlp http/grpc to noop
args: "--features noop_otlp_exporter"
package: "hive-router"
binary: "hive_router"
config: bench/configs/otel.config.yaml
compare_with_default: false
- name: "plugins"
args: ""
package: "plugin-template"
binary: "hive_router_with_plugin"
config: "bench/configs/plugins.config.yaml"
compare_with_default: true
- name: "persisted-documents"
args: ""
package: "hive-router"
binary: "hive_router"
config: "bench/configs/persisted-documents.config.yaml"
compare_with_default: true
name: benchmark / router / ${{ matrix.name }}
runs-on: ubuntu-latest
env:
NODE_NO_WARNINGS: true
NODE_ENV: production
GITHUB_PR: ${{ github.event.number }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- name: Setup wrk
run: |
sudo apt-get update
sudo apt-get install -y wrk
- name: Build subgraphs
run: cargo build --release -p subgraphs
- name: Run subgraphs
run: ./target/release/subgraphs & sleep 5
- name: Build router
run: cargo build --release -p ${{ matrix.package }} ${{matrix.args}}
- name: Run router
run: |
./target/release/${{ matrix.binary }} &
echo "$!" > router.pid
sleep 5
env:
ROUTER_CONFIG_FILE_PATH: ${{matrix.config}}
- name: Run benchmark for ${{ github.ref }}
if: github.event_name == 'pull_request'
run: ./bench/run-benchmark.sh
env:
SUMMARY_PATH: ./bench/results/pr
BENCH_PERSISTED_MODE: ${{ matrix.name == 'persisted-documents' && 'true' || '' }}
BENCH_DOCUMENT_ID: ${{ matrix.name == 'persisted-documents' && 'bench_test_query' || '' }}
- name: Checkout main branch in a separate directory
if: github.event_name == 'pull_request'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: main
path: main-branch
- name: Build router from main branch w/ default config
if: github.event_name == 'pull_request' && matrix.compare_with_default == true
run: cargo build --release -p hive-router
working-directory: main-branch
- name: Run router from main branch w/ default config
if: github.event_name == 'pull_request' && matrix.compare_with_default == true
run: |
kill $(cat router.pid)
./main-branch/target/release/hive_router &
sleep 5
env:
ROUTER_CONFIG_FILE_PATH: bench/configs/default.config.yaml
- name: Build router from main branch w/ ${{ matrix.config }} config
if: github.event_name == 'pull_request' && matrix.compare_with_default == false
run: cargo build --release -p ${{ matrix.package }} ${{matrix.args}}
working-directory: main-branch
- name: Run router from main branch w/ ${{ matrix.config }} config
if: github.event_name == 'pull_request' && matrix.compare_with_default == false
run: |
kill $(cat router.pid)
./main-branch/target/release/${{ matrix.binary }} &
sleep 5
env:
ROUTER_CONFIG_FILE_PATH: ${{matrix.config}}
- name: Run benchmark for main
if: github.event_name == 'pull_request'
run: ./bench/run-benchmark.sh
env:
SUMMARY_PATH: ./bench/results/main
- name: Compare benchmark results
if: github.event_name == 'pull_request'
run: |
chmod +x ./bench/ci-detect-regression.sh
./bench/ci-detect-regression.sh
differential:
name: test / differential
runs-on: ubuntu-latest
env:
NODE_NO_WARNINGS: true
NODE_ENV: production
GRAPHQL_DIFF_QUERIES: 250
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: build resources
run: |
cargo build -p subgraphs
cargo build -p hive-router
- name: Run subgraphs
run: |
./target/debug/subgraphs &
echo "$!" > subgraphs.pid
sleep 5
- name: Run router
run: |
./target/debug/hive_router &
echo "$!" > router.pid
sleep 5
env:
ROUTER_CONFIG_FILE_PATH: bench/configs/default.config.yaml
- name: Run monolith baseline
run: |
npm start --workspace=monolith-js &
echo "$!" > monolith.pid
sleep 5
- name: Run differential test
run: |
cargo run -p graphql-differential -- \
http://localhost:4300/graphql \
http://localhost:4000/graphql \
bench/schema.graphql
timeout-minutes: 5
- name: Stop services
if: always()
run: |
for pid_file in monolith.pid router.pid subgraphs.pid; do
if [ -f "$pid_file" ]; then
kill "$(cat "$pid_file")" 2>/dev/null || true
fi
done
- name: Upload failed test cases
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: differential-failed-tests
path: failed-tests/
graphql-over-http:
name: test / graphql-over-http
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: Run Audits
run: npm run ci:test:graphql-over-http
working-directory: audits
federation-audit:
name: test / federation-audit
runs-on: ubuntu-latest
env:
GATEWAY_TIMEOUT: 1800000 # 30 minutes, to prevent CI timeout for long-running tests
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: Run Audits
run: npm run test:federation-all
working-directory: audits
continue-on-error: true # continue even if the test fails
- name: Upload logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: federation-audit-logs
path: |
./audits/logs/*.log
- name: Run Audits (experimental_abstract_type_folding)
run: npm run test:federation-all
env:
QUERY_PLANNER_EXPERIMENTAL_ABSTRACT_TYPE_FOLDING: true
working-directory: audits
continue-on-error: true # continue even if the test fails