Skip to content

Commit

Permalink
Increase the number of times CI runs benchmarks
Browse files Browse the repository at this point in the history
This is in an attempt to provide more reliable test results. 6 was
chosen as that's the minimum number benchstat requires for a 95%
confidence interval.
  • Loading branch information
rosstimothy committed Nov 15, 2024
1 parent 5ff37d2 commit 3ffcce1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-code-nonroot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Run benchmarks once to make sure they don't break
# Must be run separate since gotestsum is not compatible with benchmark output
- name: Run Benchmarks Once
timeout-minutes: 5
timeout-minutes: 25
shell: bash # Overriding default shell which is `sh -e`
run: make test-go-bench | sed -u -E "s/^(FAIL\s+github)/::error title=Benchmark Failed::\1/"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-code-root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Run benchmarks once to make sure they don't break
# Must be run separate since gotestsum is not compatible with benchmark output
- name: Run Benchmarks Once
timeout-minutes: 5
timeout-minutes: 25
shell: bash # Overriding default shell which is `sh -e`
run: make test-go-bench-root | sed -u -E "s/^(FAIL\s+github)/::error title=Benchmark Failed::\1/"

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -943,14 +943,14 @@ endif
test-go-bench: PACKAGES = $(shell grep --exclude-dir api --include "*_test.go" -lr testing.B . | xargs dirname | xargs go list | sort -u)
test-go-bench: BENCHMARK_SKIP_PATTERN = "^BenchmarkRoot"
test-go-bench: | $(TEST_LOG_DIR)
go test -run ^$$ -bench . -skip $(BENCHMARK_SKIP_PATTERN) -benchtime 1x $(PACKAGES) \
go test -run ^$$ -bench . -skip $(BENCHMARK_SKIP_PATTERN) -count=6 -benchtime 1x $(PACKAGES) \
| tee $(TEST_LOG_DIR)/bench.txt

test-go-bench-root: PACKAGES = $(shell grep --exclude-dir api --include "*_test.go" -lr BenchmarkRoot . | xargs dirname | xargs go list | sort -u)
test-go-bench-root: BENCHMARK_PATTERN = "^BenchmarkRoot"
test-go-bench-root: BENCHMARK_SKIP_PATTERN = ""
test-go-bench-root: | $(TEST_LOG_DIR)
go test -run ^$$ -bench $(BENCHMARK_PATTERN) -skip $(BENCHMARK_SKIP_PATTERN) -benchtime 1x $(PACKAGES) \
go test -run ^$$ -bench $(BENCHMARK_PATTERN) -skip $(BENCHMARK_SKIP_PATTERN) -count=6 -benchtime 1x $(PACKAGES) \
| tee $(TEST_LOG_DIR)/bench.txt

# Make sure untagged vnetdaemon code build/tests.
Expand Down

0 comments on commit 3ffcce1

Please sign in to comment.