diff --git a/.github/workflows/ci-bench.yml b/.github/workflows/ci-bench.yml index 109eb3d9..ac827d68 100644 --- a/.github/workflows/ci-bench.yml +++ b/.github/workflows/ci-bench.yml @@ -1,11 +1,6 @@ -name: ci-build +name: ci-bench on: - push: - branches: - - master - tags-ignore: - - '*.*' - pull_request: + pull_request_target: branches: - master @@ -14,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go-version: [1.16.x,1.17.x] + go-version: [1.17.x] os: [ubuntu-latest] name: Benchstat with Go ${{ matrix.go-version }} @@ -38,11 +33,25 @@ jobs: ${{ runner.os }}-go- - name: Verify parser - if: runner.os == 'Linux' run: | make verify-parser - name: Bench and Diff + id: bench-diff run: | go install golang.org/x/perf/cmd/benchstat@latest make bench-diff + echo "::set-output name=summary::$(make print-bench-diff)" + + - name: Comment Benchmark Diffs + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: bench + message: | + ### Benchmark Diffs +
Benchmark diffs + ``` + ${{ steps.bench-diff.outputs.summary }} + ``` +
diff --git a/make/bench.mk b/make/bench.mk index a71fd7a8..143e6dc2 100644 --- a/make/bench.mk +++ b/make/bench.mk @@ -33,13 +33,15 @@ bench-diff: clean generate-optimized check-git-status | tee $(REPORTS_DIR)/v0.7.0.bench @echo "generated $(REPORTS_DIR)/v0.7.0.bench" @git checkout $(GIT_BRANCH_NAME) - @echo "" @echo "Comparing with 'master' branch" @$(GOPATH)/bin/benchstat $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench $(REPORTS_DIR)/master.bench @echo "" @echo "Comparing with 'v0.7.0' tag" - @$(GOPATH)/bin/benchstat $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench $(REPORTS_DIR)/v0.7.0.bench + @$(GOPATH)/bin/benchstat $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench $(REPORTS_DIR)/v0.7.0.bench | tee $(REPORTS_DIR)/diffs.txt +print-bench-diff: + @cat $(REPORTS_DIR)/diffs.txt + check-git-status: ifneq ("$(shell git status --porcelain)","") @echo "Repository contains uncommitted changes:"