Skip to content

Commit

Permalink
do not cache at all
Browse files Browse the repository at this point in the history
  • Loading branch information
miparnisari committed Oct 20, 2023
1 parent b2e54cd commit 9011c3c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
29 changes: 1 addition & 28 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,4 @@ jobs:
with:
go-version-file: './go.mod'
cache-dependency-path: './go.sum'
check-latest: true

# Run benchmark with `go test -bench` and stores the output to a file
- name: Run benchmark
run: |
set -o pipefail
make bench | tee bench_output.txt
- name: Get JSON for benchmark
uses: benchmark-action/github-action-benchmark@70405016b032d44f409e4b1b451c40215cbe2393 # v1.18.0
with:
# What benchmark tool the output.txt came from
tool: 'go'
# Where the output from the benchmark tool is stored
output-file-path: bench_output.txt
# Updates the file content instead of generating a Git commit in GitHub Pages branch
external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true

- name: Save benchmark data without cache
uses: actions/upload-artifact@v3
with:
name: benchmark-main
path: ./cache/benchmark-data.json
if-no-files-found: error
check-latest: true
42 changes: 33 additions & 9 deletions .github/workflows/prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,53 @@ on:
- main

jobs:
go-bench:
bench-main:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
ref: main

- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: './go.mod'
cache-dependency-path: './go.sum'
check-latest: true

# Run benchmark with `go test -bench` and stores the output to a file
- name: Run benchmark
- name: Run benchmark of main
run: |
set -o pipefail
make bench | tee ${{ github.sha }}_bench_output.txt
make bench | tee main_bench_output.txt
- name: Store benchmark result of main
uses: benchmark-action/github-action-benchmark@70405016b032d44f409e4b1b451c40215cbe2393 # v1.18.0
with:
# What benchmark tool the output.txt came from
tool: 'go'
# Where the output from the benchmark tool is stored
output-file-path: main_bench_output.txt
# Where the output from the benchmark will be stored
external-data-json-path: ./main_bench_output.json
save-data-file: true
fail-on-alert: false

bench-PR:
runs-on: ubuntu-latest
needs: [bench-main]
timeout-minutes: 15
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2

# Download previous benchmark result
- name: Download previous benchmark data
uses: actions/download-artifact@v3
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
name: benchmark-main
go-version-file: './go.mod'
cache-dependency-path: './go.sum'
check-latest: true

- name: Run benchmark of PR
run: |
set -o pipefail
make bench | tee ${{ github.sha }}_bench_output.txt
- name: Compare benchmark result
uses: benchmark-action/github-action-benchmark@70405016b032d44f409e4b1b451c40215cbe2393 # v1.18.0
Expand All @@ -37,7 +61,7 @@ jobs:
# Where the output from the benchmark tool is stored
output-file-path: ${{ github.sha }}_bench_output.txt
# Where the previous data file is stored
external-data-json-path: ./cache/benchmark-data.json
external-data-json-path: ./main_bench_output.json
# Do not save the data
save-data-file: false
# Workflow will fail when an alert happens
Expand Down

0 comments on commit 9011c3c

Please sign in to comment.