Skip to content

Commit 17a5fca

Browse files
authored
Merge pull request #1692 from pafuent/benchmark_github_action
Adding GitHub action to compare benchmarks
2 parents ad3be08 + 5b9bbbd commit 17a5fca

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/echo.yml

+52
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,55 @@ jobs:
6262
with:
6363
token:
6464
fail_ci_if_error: false
65+
benchmark:
66+
needs: test
67+
strategy:
68+
matrix:
69+
os: [ubuntu-latest]
70+
go: [1.15]
71+
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
72+
runs-on: ${{ matrix.os }}
73+
steps:
74+
- name: Set up Go ${{ matrix.go }}
75+
uses: actions/setup-go@v1
76+
with:
77+
go-version: ${{ matrix.go }}
78+
79+
- name: Set GOPATH and PATH
80+
run: |
81+
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
82+
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
83+
shell: bash
84+
85+
- name: Set build variables
86+
run: |
87+
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
88+
echo "GO111MODULE=on" >> $GITHUB_ENV
89+
90+
- name: Checkout Code (Previous)
91+
uses: actions/checkout@v2
92+
with:
93+
ref: ${{ github.base_ref }}
94+
path: previous
95+
96+
- name: Checkout Code (New)
97+
uses: actions/checkout@v2
98+
with:
99+
path: new
100+
101+
- name: Install Dependencies
102+
run: go get -v golang.org/x/perf/cmd/benchstat
103+
104+
- name: Run Benchmark (Previous)
105+
run: |
106+
cd previous
107+
go test -run="-" -bench=".*" -count=5 ./... > benchmark.txt
108+
109+
- name: Run Benchmark (New)
110+
run: |
111+
cd new
112+
go test -run="-" -bench=".*" -count=5 ./... > benchmark.txt
113+
114+
- name: Run Benchstat
115+
run: |
116+
benchstat previous/benchmark.txt new/benchmark.txt

0 commit comments

Comments
 (0)