From 998838403285623cc5b421803632d5adaa09c72f Mon Sep 17 00:00:00 2001 From: Marco Manino Date: Fri, 7 Jun 2024 10:29:51 +0200 Subject: [PATCH] Setting up benchmark result persistance --- .github/workflows/go.yaml | 41 ++++++++++++++++++++++++++++++++++++++- test/admission_test.go | 13 +++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index edd7b5d8..46580e61 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -93,7 +93,30 @@ jobs: run: go mod download - name: Run benchmarks - run: make go.bench + run: make go.bench | tee output.txt + + - name: Download previous benchmark data + uses: actions/cache@v4 + with: + path: ./benchmarks + key: ${{ runner.os }}-benchmark + + - name: Store benchmarks result + uses: benchmark-action/github-action-benchmark@v1.20.3 + with: + name: SQLite + tool: 'go' + output-file-path: output.txt + external-data-json-path: ./benchmarks/data.json + github-token: ${{ secrets.GITHUB_TOKEN }} + gh-pages-branch: gh-pages + benchmark-data-dir-path: "benchmarks" + alert-threshold: "150%" + summary-always: true + comment-always: true + fail-on-alert: true + fail-threshold: "400%" + benchmarks-dqlite: name: Benchmark dqlite @@ -114,6 +137,22 @@ jobs: - name: Run benchmarks run: make go.bench.dqlite + - name: Store benchmarks result + uses: benchmark-action/github-action-benchmark@v1.20.3 + with: + name: dqlite + tool: 'go' + output-file-path: output.txt + external-data-json-path: ./benchmarks/data.json + github-token: ${{ secrets.GITHUB_TOKEN }} + gh-pages-branch: gh-pages + benchmark-data-dir-path: "benchmarks" + alert-threshold: "150%" + summary-always: true + comment-always: true + fail-on-alert: true + fail-threshold: "400%" + build: name: Build k8s-dqlite runs-on: ubuntu-latest diff --git a/test/admission_test.go b/test/admission_test.go index 9452ea4a..42d6dd13 100644 --- a/test/admission_test.go +++ b/test/admission_test.go @@ -13,6 +13,19 @@ import ( clientv3 "go.etcd.io/etcd/client/v3" ) +func Fib(u uint) uint { + if u <= 1 { + return 1 + } + return Fib(u-2) + Fib(u-1) +} +func BenchmarkFib20WithAuxMetric(b *testing.B) { + for i := 0; i < b.N; i++ { + var _ = Fib(20) + } + b.ReportMetric(4.0, "auxMetricUnits") +} + // TestAdmissionControl puts heavy load on kine and expects that some requests are denied // by the admission control. func TestAdmissionControl(t *testing.T) {