Skip to content

Commit 5394f64

Browse files
authored
ci: More bencher upload fixes (#2945)
1 parent 41ce558 commit 5394f64

File tree

1 file changed

+47
-36
lines changed

1 file changed

+47
-36
lines changed

.github/workflows/bencher-upload.yml

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
bencher_upload:
14-
name: Upload to bencher.dev
14+
name: Upload
1515
# The bench workflow fails when a regression is detected, but we want to upload results regardless.
1616
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'
1717
permissions:
@@ -23,6 +23,8 @@ jobs:
2323
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
2424
GITHUB_EVENT_PATH: event.json
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
SHA: ${{ github.event.workflow_run.referenced_workflows[0].sha != '' && github.event.workflow_run.referenced_workflows[0].sha || github.event.workflow_run.head_sha }}
27+
DATA_TAG: ${{ github.event.workflow.name == 'cargo bench' && 'bench' || 'perfcompare' }}
2628

2729
steps:
2830
- env:
@@ -34,7 +36,7 @@ jobs:
3436
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
3537
with:
3638
run-id: ${{ github.event.workflow_run.id }}
37-
name: ${{ github.event.repository.name }}-${{ github.event.workflow_run.referenced_workflows[0].sha != '' && github.event.workflow_run.referenced_workflows[0].sha || github.event.workflow_run.head_sha }}-bench-perf
39+
name: ${{ github.event.repository.name }}-${{ env.SHA }}-${{ env.DATA_TAG }}-perf
3840
github-token: ${{ secrets.GITHUB_TOKEN }}
3941

4042
- name: Export PR event data
@@ -50,22 +52,10 @@ jobs:
5052
5153
- uses: bencherdev/[email protected] # zizmor: ignore[unpinned-uses]
5254

53-
- name: Upload main-branch results to bencher.dev
55+
- name: Upload main-branch results
5456
run: |
5557
ls -la
56-
bencher run \
57-
--branch main \
58-
--hash "$(cat main-sha.txt)" \
59-
--testbed "$(cat testbed.txt)" \
60-
--threshold-measure latency \
61-
--threshold-test t_test \
62-
--threshold-upper-boundary 0.99 \
63-
--thresholds-reset \
64-
--err \
65-
--adapter rust_criterion \
66-
--github-actions "$GITHUB_TOKEN" \
67-
--file results-main.txt
68-
for file in hyperfine-main/*.json; do
58+
if [ "$DATA_TAG" == "bench" ]; then
6959
bencher run \
7060
--branch main \
7161
--hash "$(cat main-sha.txt)" \
@@ -75,27 +65,32 @@ jobs:
7565
--threshold-upper-boundary 0.99 \
7666
--thresholds-reset \
7767
--err \
78-
--adapter shell_hyperfine \
68+
--adapter rust_criterion \
7969
--github-actions "$GITHUB_TOKEN" \
80-
--file "$file"
81-
done
70+
--file results-main.txt
71+
else
72+
ls -la hyperfine-main
73+
for file in hyperfine-main/*.json; do
74+
bencher run \
75+
--branch main \
76+
--hash "$(cat main-sha.txt)" \
77+
--testbed "$(cat testbed.txt)" \
78+
--threshold-measure latency \
79+
--threshold-test t_test \
80+
--threshold-upper-boundary 0.99 \
81+
--thresholds-reset \
82+
--err \
83+
--adapter shell_hyperfine \
84+
--github-actions "$GITHUB_TOKEN" \
85+
--file "$file"
86+
done
87+
fi
8288
83-
- name: Upload PR results to bencher.dev
89+
- name: Upload PR results
8490
if: env.PR_HEAD != '' && env.PR_BASE != '' && env.PR_BASE_SHA != '' && env.PR_NUMBER != ''
8591
run: |
86-
bencher run \
87-
--branch "$PR_HEAD" \
88-
--testbed "$(cat testbed.txt)" \
89-
--start-point "$PR_BASE" \
90-
--start-point-hash "$PR_BASE_SHA" \
91-
--start-point-clone-thresholds \
92-
--start-point-reset \
93-
--err \
94-
--adapter rust_criterion \
95-
--github-actions "$GITHUB_TOKEN" \
96-
--ci-number "$PR_NUMBER" \
97-
--file results.txt
98-
for file in hyperfine/*neqo*.json; do
92+
ls -la
93+
if [ "$DATA_TAG" == "bench" ]; then
9994
bencher run \
10095
--branch "$PR_HEAD" \
10196
--testbed "$(cat testbed.txt)" \
@@ -104,8 +99,24 @@ jobs:
10499
--start-point-clone-thresholds \
105100
--start-point-reset \
106101
--err \
107-
--adapter shell_hyperfine \
102+
--adapter rust_criterion \
108103
--github-actions "$GITHUB_TOKEN" \
109104
--ci-number "$PR_NUMBER" \
110-
--file "$file"
111-
done
105+
--file results.txt
106+
else
107+
ls -la hyperfine
108+
for file in hyperfine/*neqo*.json; do
109+
bencher run \
110+
--branch "$PR_HEAD" \
111+
--testbed "$(cat testbed.txt)" \
112+
--start-point "$PR_BASE" \
113+
--start-point-hash "$PR_BASE_SHA" \
114+
--start-point-clone-thresholds \
115+
--start-point-reset \
116+
--err \
117+
--adapter shell_hyperfine \
118+
--github-actions "$GITHUB_TOKEN" \
119+
--ci-number "$PR_NUMBER" \
120+
--file "$file"
121+
done
122+
fi

0 commit comments

Comments
 (0)