Skip to content

Commit

Permalink
use GITHUB_SHA
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon committed Apr 18, 2022
1 parent ee8cfa6 commit bac9485
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions make/bench.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ bench: clean generate-optimized
@mkdir -p $(REPORTS_DIR)
@go test -tags bench -bench=. -benchmem -count=$(BENCH_COUNT) -run=XXX \
github.com/bytesparadise/libasciidoc \
| tee $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench
@echo "generated $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench"
| tee $(REPORTS_DIR)/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).bench
@echo "generated $(REPORTS_DIR)/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).bench"

.PHONY: bench-diff
## run the top-level benchmarks and compares with results of 'master' and 'v0.7.0'
Expand All @@ -21,8 +21,8 @@ bench-diff: clean generate-optimized check-git-status
@mkdir -p $(REPORTS_DIR)
@go test -tags bench -bench=. -benchmem -count=$(BENCH_COUNT) -run=XXX \
github.com/bytesparadise/libasciidoc \
| tee $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench
@echo "generated $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench"
| tee $(REPORTS_DIR)/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).bench
@echo "generated $(REPORTS_DIR)/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).bench"
@git checkout master
@go test -tags bench -bench=. -benchmem -count=$(BENCH_COUNT) -run=XXX \
github.com/bytesparadise/libasciidoc \
Expand All @@ -33,13 +33,13 @@ bench-diff: clean generate-optimized check-git-status
github.com/bytesparadise/libasciidoc \
| tee $(REPORTS_DIR)/v0.7.0.bench
@echo "generated $(REPORTS_DIR)/v0.7.0.bench"
@git checkout $(GIT_BRANCH_NAME)
@echo "HEAD is now at $(git rev-parse --abbrev-ref HEAD) (expecting $(GIT_BRANCH_NAME))"
@git checkout $(GITHUB_SHA)
@echo "HEAD is now at $(git rev-parse --abbrev-ref HEAD) (expecting $(GITHUB_SHA))"
@echo "Comparing with 'master' branch"
@$(GOPATH)/bin/benchstat $(REPORTS_DIR)/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).bench $(REPORTS_DIR)/master.bench
@$(GOPATH)/bin/benchstat $(REPORTS_DIR)/$(GITHUB_SHA)-$(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 | tee $(REPORTS_DIR)/diffs.txt
@$(GOPATH)/bin/benchstat $(REPORTS_DIR)/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).bench $(REPORTS_DIR)/v0.7.0.bench | tee $(REPORTS_DIR)/diffs.txt

.PHONY: print-bench-diff
print-bench-diff:
Expand Down
2 changes: 1 addition & 1 deletion make/git.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ ifneq ($(shell git status --porcelain),)
GIT_COMMIT_ID_SHORT := $(GIT_COMMIT_ID_SHORT)-dirty
endif

GIT_BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD)
GITHUB_SHA ?= $(shell git rev-parse --abbrev-ref HEAD)

BUILD_TIME = `date -u '+%Y-%m-%dT%H:%M:%SZ'`
20 changes: 10 additions & 10 deletions make/profile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
## run the profilers on the parser
profile: generate-optimized
@mkdir -p ./tmp/bench/reports
@go test -cpuprofile=tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).cpu.prof \
-memprofile tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).mem.prof \
@go test -cpuprofile=tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).cpu.prof \
-memprofile tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).mem.prof \
-bench=. \
-benchtime=10x \
github.com/bytesparadise/libasciidoc \
-run=XXX
@echo "generate CPU reports..."
@go tool pprof -text -output=tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).cpu.txt \
tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).cpu.prof
@go tool pprof -text -output=tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).cpu.txt \
tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).cpu.prof
ifndef CI
@go tool pprof -svg -output=tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).cpu.svg \
tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).cpu.prof
@go tool pprof -svg -output=tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).cpu.svg \
tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).cpu.prof
endif
@echo "generate memory reports"
@go tool pprof -text -output=tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).mem.txt \
tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).mem.prof
@go tool pprof -text -output=tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).mem.txt \
tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).mem.prof
ifndef CI
@go tool pprof -svg -output=tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).mem.svg \
tmp/bench/reports/$(GIT_BRANCH_NAME)-$(GIT_COMMIT_ID_SHORT).mem.prof
@go tool pprof -svg -output=tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).mem.svg \
tmp/bench/reports/$(GITHUB_SHA)-$(GIT_COMMIT_ID_SHORT).mem.prof
endif

0 comments on commit bac9485

Please sign in to comment.