Skip to content

Commit 58d2bac

Browse files
ardatandotansimha
authored andcommitted
chore(ci): cleanup extra steps (#780)
- No extra need for `rust-cache` workflow because `setup-rust-toolchain` already uses it - We no longer comment benchmark results, so we can remove it - Then no longer need to have duplicate steps for running K6 on the branch - No need to have extra workflows for audits, we don't comment them already. They are just for success/fail checks from JUnit reports
1 parent c6fe2e1 commit 58d2bac

7 files changed

Lines changed: 252 additions & 178 deletions

File tree

.github/workflows/build-router.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ jobs:
3636
steps:
3737
- name: checkout
3838
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
39-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
40-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
41-
with:
42-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
39+
- name: setup rust
40+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
4341
- name: generate config schema
4442
run: cargo router-config
4543
- name: setup node
@@ -101,14 +99,11 @@ jobs:
10199
steps:
102100
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
103101
name: checkout
104-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
105-
name: rust toolchain (${{ matrix.rust_target }})
102+
- name: setup rust (${{ matrix.rust_target }})
103+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
106104
with:
107105
target: ${{ matrix.rust_target }}
108106
cache-key: ${{ matrix.name }}
109-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
110-
with:
111-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
112107

113108
# Only if using Zigbuild
114109
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2

.github/workflows/ci.yaml

Lines changed: 27 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
26-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
27-
with:
28-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
25+
- name: setup rust
26+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
2927
- name: test all
3028
run: cargo test_all
3129
timeout-minutes: 5
@@ -37,10 +35,8 @@ jobs:
3735
runs-on: ubuntu-latest
3836
steps:
3937
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
40-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
41-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
42-
with:
43-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
38+
- name: setup rust
39+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
4440
- name: test e2e
4541
run: cargo test_e2e
4642
timeout-minutes: 60
@@ -69,10 +65,8 @@ jobs:
6965
runs-on: ubuntu-latest
7066
steps:
7167
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
72-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
73-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
74-
with:
75-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
68+
- name: setup rust
69+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
7670
- name: build
7771
run: cargo build --release
7872

@@ -81,15 +75,10 @@ jobs:
8175
runs-on: ubuntu-latest
8276
steps:
8377
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
84-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
85-
with:
86-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
87-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
78+
- name: setup rust
79+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
8880
with:
8981
components: rustfmt
90-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
91-
with:
92-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
9382
- name: cargo fmt
9483
uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1
9584

@@ -98,12 +87,10 @@ jobs:
9887
runs-on: ubuntu-latest
9988
steps:
10089
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
101-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
90+
- name: setup rust
91+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
10292
with:
10393
components: clippy
104-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
105-
with:
106-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
10794
- name: cargo clippy
10895
run: cargo clippy --all
10996

@@ -121,10 +108,8 @@ jobs:
121108
runs-on: ubuntu-latest
122109
steps:
123110
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
124-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
125-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
126-
with:
127-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
111+
- name: setup rust
112+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
128113
- if: matrix.name == 'executor'
129114
name: Build subgraphs
130115
run: cargo build --release -p subgraphs
@@ -169,10 +154,8 @@ jobs:
169154
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170155
steps:
171156
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
172-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
173-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
174-
with:
175-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
157+
- name: setup rust
158+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
176159
- name: Setup K6
177160
run: |
178161
wget https://github.com/grafana/k6/releases/download/v0.37.0/k6-v0.37.0-linux-amd64.deb
@@ -191,14 +174,9 @@ jobs:
191174
sleep 5
192175
env:
193176
ROUTER_CONFIG_FILE_PATH: ${{matrix.config}}
194-
# run only on main
195-
- name: Run k6 benchmark for Pull Request
196-
if: github.event_name == 'push'
197-
run: k6 run bench/k6.js
198-
# run only on PR
199-
- name: Run k6 benchmark for Pull Request
177+
- name: Run k6 benchmark for ${{ github.ref }}
200178
if: github.event_name == 'pull_request'
201-
run: k6 run -e SUMMARY_PATH=./bench/results/pr -e NO_GITHUB_COMMENT=true bench/k6.js
179+
run: k6 run -e SUMMARY_PATH=./bench/results/pr bench/k6.js
202180
- name: Checkout main branch in a separate directory
203181
if: github.event_name == 'pull_request'
204182
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@@ -219,7 +197,7 @@ jobs:
219197
ROUTER_CONFIG_FILE_PATH: ${{matrix.config}}
220198
- name: Run k6 benchmark for main
221199
if: github.event_name == 'pull_request'
222-
run: k6 run -e SUMMARY_PATH=./bench/results/main -e NO_GITHUB_COMMENT=true bench/k6.js
200+
run: k6 run -e SUMMARY_PATH=./bench/results/main bench/k6.js
223201
- name: Compare benchmark results
224202
if: github.event_name == 'pull_request'
225203
run: |
@@ -231,15 +209,14 @@ jobs:
231209
runs-on: ubuntu-latest
232210
steps:
233211
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
234-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
235-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
236-
with:
237-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
212+
- name: setup rust
213+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
238214
- name: setup node
239215
uses: the-guild-org/shared-config/setup@v1
240216
with:
241217
node-version-file: .node-version
242-
- run: npm run ci:test:graphql-over-http
218+
- name: Run Audits
219+
run: npm run ci:test:graphql-over-http
243220
working-directory: audits
244221
- name: Publish Test Results for comparison
245222
uses: EnricoMi/publish-unit-test-result-action@27d65e188ec43221b20d26de30f4892fad91df2f # v2
@@ -250,42 +227,22 @@ jobs:
250227
comment_mode: off
251228
files: |
252229
audits/reports/*.xml
253-
- name: Publish Test Results for details
254-
uses: mikepenz/action-junit-report@74626db7353a25a20a72816467ebf035f674c5f8 # v6
255-
if: (!cancelled())
256-
with:
257-
report_paths: "audits/reports/*.xml"
258-
group_reports: false
259-
job_name: test / graphql-over-http
260-
check_name: test / graphql-over-http
261-
annotate_only: true
262-
fail_on_failure: true
263-
fail_on_parse_error: true
264-
job_summary: true
265-
verbose_summary: false
266-
skip_success_summary: true
267-
include_empty_in_summary: false
268-
include_time_in_summary: true
269-
simplified_summary: true
270-
group_suite: true
271-
comment: false
272-
exclude_sources: /lib/,/audits/node_modules/
273230
274231
federation-audit:
275232
name: test / federation-audit
276233
runs-on: ubuntu-latest
277234
steps:
278235
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
279-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
280-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
281-
with:
282-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
283-
- run: cargo build --package hive-router
236+
- name: setup rust
237+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
284238
- name: setup node
285239
uses: the-guild-org/shared-config/setup@v1
286240
with:
287241
node-version-file: .node-version
288-
- run: npm run test:federation-all
242+
- name: Run Audits
243+
run: npm run test:federation-all
244+
env:
245+
GATEWAY_TIMEOUT: 1_800_000 # 30 minutes, to prevent CI timeout for long-running tests
289246
working-directory: audits
290247
continue-on-error: true # continue even if the test fails
291248
- name: Upload logs
@@ -305,24 +262,3 @@ jobs:
305262
comment_mode: off
306263
files: |
307264
audits/reports/*.xml
308-
- name: Publish Test Results for details
309-
uses: mikepenz/action-junit-report@74626db7353a25a20a72816467ebf035f674c5f8 # v6
310-
if: (!cancelled())
311-
with:
312-
report_paths: "audits/reports/*.xml"
313-
group_reports: false
314-
job_name: test / federation-audit
315-
check_name: test / federation-audit
316-
check_title_template: "{{FILE_NAME}}"
317-
fail_on_failure: true
318-
fail_on_parse_error: true
319-
annotate_only: true
320-
job_summary: true
321-
verbose_summary: false
322-
skip_success_summary: true
323-
include_empty_in_summary: false
324-
include_time_in_summary: true
325-
simplified_summary: true
326-
group_suite: true
327-
comment: false
328-
exclude_sources: /lib/,/audits/node_modules/

.github/workflows/release.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ jobs:
1818
crates_to_publish: ${{ steps.check_crates.outputs.crates_to_publish }}
1919
steps:
2020
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
21+
- name: setup rust
22+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
2223
with:
2324
cache: false
24-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
25-
with:
26-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
2725
- name: Run release-crates-check.sh
2826
id: check_crates
2927
run: |
@@ -47,13 +45,11 @@ jobs:
4745
if: ${{ github.repository_owner == 'graphql-hive' && needs.check.outputs.crates_to_publish != '{}' }}
4846
steps:
4947
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
50-
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
48+
- name: setup rust
49+
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
5150
with:
5251
cache: false
5352

54-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
55-
with:
56-
shared-key: ${{ hashFiles('**/Cargo.lock') }}
5753

5854
- name: authenticate with crates.io
5955
uses: rust-lang/crates-io-auth-action@v1

audits/graphql-over-http.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { describe, it } from "node:test";
22
import { serverAudits } from "graphql-http";
33
import assert from "node:assert";
4-
import { fetch } from '@whatwg-node/fetch';
54

65
describe("GraphQL over HTTP", () => {
76
for (const audit of serverAudits({
87
url: "http://localhost:4000/graphql",
9-
fetchFn: fetch,
108
})) {
119
it(audit.name, async () => {
1210
const result = await audit.fn();

audits/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"ci:test:graphql-over-http": "start-server-and-test start:test-router http://localhost:4000 test-junit:graphql-over-http"
1212
},
1313
"devDependencies": {
14-
"graphql-federation-gateway-audit": "the-guild-org/graphql-federation-gateway-audit",
14+
"graphql-federation-gateway-audit": "graphql-hive/federation-gateway-audit#6a1f8e3",
1515
"graphql-http": "1.22.4",
1616
"typescript": "5.9.3",
1717
"start-server-and-test": "2.1.3"
1818
},
1919
"packageManager": "npm@11.10.0"
20-
}
20+
}

bench/k6.js

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,6 @@ export default function () {
2222
makeGraphQLRequest();
2323
}
2424

25-
export function handleSummary(data) {
26-
if (__ENV.GITHUB_TOKEN && __ENV.NO_GITHUB_COMMENT !== 'true') {
27-
githubComment(data, {
28-
token: __ENV.GITHUB_TOKEN,
29-
commit: __ENV.GITHUB_SHA,
30-
pr: __ENV.GITHUB_PR,
31-
org: "graphql-hive",
32-
repo: "router",
33-
commentKey: `k6-benchmark`,
34-
renderTitle({ passes }) {
35-
return passes
36-
? `✅ \`k6-benchmark\` results`
37-
: `❌ \`k6-benchmark\` failed`;
38-
},
39-
renderMessage({ passes, checks, thresholds }) {
40-
const result = [];
41-
42-
if (thresholds.failures) {
43-
result.push(`**Performance regression detected**`);
44-
}
45-
46-
if (checks.failures) {
47-
result.push("**Failed assertions detected**");
48-
}
49-
50-
if (!passes) {
51-
result.push(
52-
`> If the performance regression is expected, please increase the failing threshold.`
53-
);
54-
}
55-
56-
return result.join("\n");
57-
},
58-
});
59-
}
60-
return handleBenchmarkSummary(data, { vus, duration });
61-
}
62-
6325
let printIdentifiersMap = {};
6426
let runIdentifiersMap = {};
6527

@@ -149,7 +111,7 @@ const graphqlRequest = {
149111
},
150112
};
151113

152-
function handleBenchmarkSummary(data, additionalContext = {}) {
114+
export function handleSummary(data) {
153115
const out = {
154116
stdout: textSummary(data, { indent: " ", enableColors: true }),
155117
};
@@ -159,7 +121,7 @@ function handleBenchmarkSummary(data, additionalContext = {}) {
159121
`Writing summary to ${__ENV.SUMMARY_PATH}/k6_summary.json and .txt`,
160122
);
161123
out[`${__ENV.SUMMARY_PATH}/k6_summary.json`] = JSON.stringify(
162-
Object.assign(data, additionalContext),
124+
Object.assign(data, { vus, duration }),
163125
);
164126
out[`${__ENV.SUMMARY_PATH}/k6_summary.txt`] = textSummary(data, {
165127
indent: " ",

0 commit comments

Comments
 (0)