From a8c810f7ef5f1fadfd6bd2505ac86cc5f0976a38 Mon Sep 17 00:00:00 2001 From: aidenwong812 Date: Tue, 24 Dec 2024 12:31:15 -0500 Subject: [PATCH 1/4] Continuous benchmark --- .github/workflows/benchmark.yml | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 00000000..b2a63727 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,61 @@ +name: Benchmark + +on: + pull_request: + push: + branches: ["main"] + +jobs: + benchmark: + name: Performance regression check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: "stable" + + # Run benchmark with `go test -bench` and stores the output to a file + - name: Run benchmark + run: go test -bench 'BenchmarkFib' | tee output.txt + + # Download previous benchmark result from cache (if exists) + - name: Download previous benchmark data + uses: actions/cache@v4 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + + # Run `github-action-benchmark` action + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Go Benchmark + # What benchmark tool the output.txt came from + tool: 'go' + # Where the output from the benchmark tool is stored + output-file-path: output.txt + # Where the previous data file is stored + external-data-json-path: ./cache/benchmark-data.json + github-token: ${{ secrets.GITHUB_TOKEN }} + auto-push: true + # Show alert with commit comment on detecting possible performance regression + alert-threshold: '200%' + comment-on-alert: true + # Workflow will fail when an alert happens + fail-on-alert: true + + # Upload the updated cache file for the next job by actions/cache + - name: Store benchmark result - separate results repo + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Go Benchmark + tool: 'go' + output-file-path: output.txt + github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }} + auto-push: true + # Show alert with commit comment on detecting possible performance regression + alert-threshold: '200%' + comment-on-alert: true + fail-on-alert: true + gh-repository: 'github.com/go-fuego/fuego' \ No newline at end of file From d831134d8f991bb0f15fe8ceea8448839aa43bed Mon Sep 17 00:00:00 2001 From: aidenwong812 Date: Tue, 24 Dec 2024 14:04:19 -0500 Subject: [PATCH 2/4] fix bechmark result store bug --- .github/workflows/benchmark.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b2a63727..d2bb47bb 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -35,8 +35,6 @@ jobs: tool: 'go' # Where the output from the benchmark tool is stored output-file-path: output.txt - # Where the previous data file is stored - external-data-json-path: ./cache/benchmark-data.json github-token: ${{ secrets.GITHUB_TOKEN }} auto-push: true # Show alert with commit comment on detecting possible performance regression From 143fef7f8290c9f907569abb0fc910c765296a21 Mon Sep 17 00:00:00 2001 From: aidenwong812 Date: Wed, 25 Dec 2024 11:11:43 -0500 Subject: [PATCH 3/4] test output path --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d2bb47bb..01793544 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -34,7 +34,7 @@ jobs: # What benchmark tool the output.txt came from tool: 'go' # Where the output from the benchmark tool is stored - output-file-path: output.txt + output-file-path: ./output.txt github-token: ${{ secrets.GITHUB_TOKEN }} auto-push: true # Show alert with commit comment on detecting possible performance regression @@ -49,7 +49,7 @@ jobs: with: name: Go Benchmark tool: 'go' - output-file-path: output.txt + output-file-path: ./output.txt github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }} auto-push: true # Show alert with commit comment on detecting possible performance regression From 13d25c32e3788a4c3ee66c2a62ee32067defd5e9 Mon Sep 17 00:00:00 2001 From: aidenwong812 Date: Sun, 19 Jan 2025 10:33:54 -0500 Subject: [PATCH 4/4] test CI --- .github/workflows/benchmark.yml | 60 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 01793544..fabc2f8a 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -26,34 +26,34 @@ jobs: path: ./cache key: ${{ runner.os }}-benchmark - # Run `github-action-benchmark` action - - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1 - with: - name: Go Benchmark - # What benchmark tool the output.txt came from - tool: 'go' - # Where the output from the benchmark tool is stored - output-file-path: ./output.txt - github-token: ${{ secrets.GITHUB_TOKEN }} - auto-push: true - # Show alert with commit comment on detecting possible performance regression - alert-threshold: '200%' - comment-on-alert: true - # Workflow will fail when an alert happens - fail-on-alert: true + # # Run `github-action-benchmark` action + # - name: Store benchmark result + # uses: benchmark-action/github-action-benchmark@v1 + # with: + # name: Go Benchmark + # # What benchmark tool the output.txt came from + # tool: 'go' + # # Where the output from the benchmark tool is stored + # output-file-path: ./output.txt + # github-token: ${{ secrets.GITHUB_TOKEN }} + # auto-push: true + # # Show alert with commit comment on detecting possible performance regression + # alert-threshold: '200%' + # comment-on-alert: true + # # Workflow will fail when an alert happens + # fail-on-alert: true - # Upload the updated cache file for the next job by actions/cache - - name: Store benchmark result - separate results repo - uses: benchmark-action/github-action-benchmark@v1 - with: - name: Go Benchmark - tool: 'go' - output-file-path: ./output.txt - github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }} - auto-push: true - # Show alert with commit comment on detecting possible performance regression - alert-threshold: '200%' - comment-on-alert: true - fail-on-alert: true - gh-repository: 'github.com/go-fuego/fuego' \ No newline at end of file + # # Upload the updated cache file for the next job by actions/cache + # - name: Store benchmark result - separate results repo + # uses: benchmark-action/github-action-benchmark@v1 + # with: + # name: Go Benchmark + # tool: 'go' + # output-file-path: ./output.txt + # github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }} + # auto-push: true + # # Show alert with commit comment on detecting possible performance regression + # alert-threshold: '200%' + # comment-on-alert: true + # fail-on-alert: true + # gh-repository: 'github.com/go-fuego/fuego' \ No newline at end of file