File tree Expand file tree Collapse file tree 1 file changed +71
-0
lines changed
Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Benchmark
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ permissions :
12+ contents : read
13+
14+ # Ensure scripts are run with pipefail. See:
15+ # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
16+ defaults :
17+ run :
18+ shell : bash
19+
20+ jobs :
21+ benchmark :
22+ runs-on :
23+ - ' self-hosted'
24+ - ' 1ES.Pool=TypeScript-1ES-GitHub-Large'
25+ - ' 1ES.ImageOverride=mariner-2.0'
26+
27+ steps :
28+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+ with :
30+ submodules : true
31+ - uses : actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
32+ - uses : actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
33+ with :
34+ go-version : ' >=1.23.0'
35+
36+ - run : npm ci
37+
38+ - name : Run benchmark
39+ run : go test -run='^$' -bench=. -benchmem -count=10 ./... > new.txt
40+
41+ - name : Switch to parent commit
42+ run : git switch --detach HEAD^1
43+
44+ - run : npm ci
45+
46+ - run : git submodule update --init --recursive
47+
48+ - name : Run benchmark
49+ run : go test -run='^$' -bench=. -benchmem -count=10 ./... > old.txt
50+
51+ - run : go install golang.org/x/perf/cmd/benchstat@latest
52+
53+ - name : Compare benchmarks
54+ run : benchstat old.txt new.txt | tee benchstat.txt
55+
56+ - uses : actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
57+ with :
58+ name : benchmarks
59+ path : |
60+ old.txt
61+ new.txt
62+ benchstat.txt
63+
64+ - name : Create step summary
65+ run : |
66+ echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
67+ echo "# Benchmark Results" >> $GITHUB_STEP_SUMMARY
68+ echo "" >> $GITHUB_STEP_SUMMARY
69+ echo '```' >> $GITHUB_STEP_SUMMARY
70+ cat benchstat.txt >> $GITHUB_STEP_SUMMARY
71+ echo '```' >> $GITHUB_STEP_SUMMARY
You can’t perform that action at this time.
0 commit comments