-
Notifications
You must be signed in to change notification settings - Fork 19
311 lines (300 loc) · 11.1 KB
/
Copy pathci.yaml
File metadata and controls
311 lines (300 loc) · 11.1 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
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: test e2e
run: cargo test_e2e
timeout-minutes: 60
env:
RUST_BACKTRACE: full
RUST_LOG: debug
node-addon-test:
name: test / node-addon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: build
run: cargo build --release
fmt:
name: check / fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
with:
components: rustfmt
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: cargo fmt
uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1
clippy:
name: check / clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
with:
components: clippy
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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: benchmark / ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: ${{matrix.package}}-benchmark-results
path: ${{matrix.package}}/target/criterion
router-benchmark:
name: benchmark / router
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: Setup K6
run: |
wget https://github.com/grafana/k6/releases/download/v0.37.0/k6-v0.37.0-linux-amd64.deb
sudo apt-get update
sudo apt-get install ./k6-v0.37.0-linux-amd64.deb
- 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 hive-router
- name: Run router
run: |
./target/release/hive_router &
echo "$!" > router.pid
sleep 5
env:
SUPERGRAPH_FILE_PATH: bench/supergraph.graphql
# run only on main
- name: Run k6 benchmark for Pull Request
if: github.event_name == 'push'
run: k6 run bench/k6.js
# run only on PR
- name: Run k6 benchmark for Pull Request
if: github.event_name == 'pull_request'
run: k6 run -e SUMMARY_PATH=./bench/results/pr bench/k6.js
- name: Checkout main branch in a separate directory
if: github.event_name == 'pull_request'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: main
path: main-branch
- name: Build router
if: github.event_name == 'pull_request'
run: cargo build --release -p hive-router
working-directory: main-branch
- name: Run router
if: github.event_name == 'pull_request'
run: |
kill $(cat router.pid)
./main-branch/target/release/hive_router &
sleep 5
env:
SUPERGRAPH_FILE_PATH: bench/supergraph.graphql
- name: Run k6 benchmark for main
if: github.event_name == 'pull_request'
run: k6 run -e SUMMARY_PATH=./bench/results/main -e NO_GITHUB_COMMENT=true bench/k6.js
- name: Compare benchmark results
if: github.event_name == 'pull_request'
run: |
chmod +x ./bench/ci-detect-regression.sh
./bench/ci-detect-regression.sh
graphql-over-http:
name: test / graphql-over-http
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- run: npm run ci:test:graphql-over-http
working-directory: audits
- name: Publish Test Results for comparison
uses: EnricoMi/publish-unit-test-result-action@27d65e188ec43221b20d26de30f4892fad91df2f # v2
if: (!cancelled())
with:
check_name: test / graphql-over-http
comment_title: GraphQL over HTTP Audit Results
comment_mode: off
files: |
audits/reports/*.xml
- name: Publish Test Results for details
uses: mikepenz/action-junit-report@74626db7353a25a20a72816467ebf035f674c5f8 # v6
if: (!cancelled())
with:
report_paths: "audits/reports/*.xml"
group_reports: false
job_name: test / graphql-over-http
check_name: test / graphql-over-http
annotate_only: true
fail_on_failure: true
fail_on_parse_error: true
job_summary: true
verbose_summary: false
skip_success_summary: true
include_empty_in_summary: false
include_time_in_summary: true
simplified_summary: true
group_suite: true
comment: false
exclude_sources: /lib/,/audits/node_modules/
federation-audit:
name: test / federation-audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- run: cargo build --package hive-router
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: federation-audit-logs
path: |
./audits/logs/*.log
- name: Publish Test Results for comparison
uses: EnricoMi/publish-unit-test-result-action@27d65e188ec43221b20d26de30f4892fad91df2f # v2
if: (!cancelled())
with:
fail_on: "nothing"
check_name: test / federation-audit
comment_title: Federation Audit Results
comment_mode: off
files: |
audits/reports/*.xml
- name: Publish Test Results for details
uses: mikepenz/action-junit-report@74626db7353a25a20a72816467ebf035f674c5f8 # v6
if: (!cancelled())
with:
report_paths: "audits/reports/*.xml"
group_reports: false
job_name: test / federation-audit
check_name: test / federation-audit
check_title_template: "{{FILE_NAME}}"
fail_on_failure: true
fail_on_parse_error: true
annotate_only: true
job_summary: true
verbose_summary: false
skip_success_summary: true
include_empty_in_summary: false
include_time_in_summary: true
simplified_summary: true
group_suite: true
comment: false
exclude_sources: /lib/,/audits/node_modules/