Skip to content

Commit

Permalink
template out benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Oct 3, 2024
1 parent 15716b5 commit 35b56ac
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 50 deletions.
66 changes: 16 additions & 50 deletions .github/workflows/ach.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,19 @@ permissions:
contents: write

jobs:
run:
name: Run
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
with:
repository: 'moov-io/benchmarks'

- uses: actions/checkout@v4
with:
repository: 'moov-io/ach'
path: './ach/'

- uses: actions/setup-go@v5
with:
go-version: "stable"

- name: moov-io/ach
run: |
cd ./ach/
go test . -bench BenchmarkBuildFile -benchmem > output.txt
go test . -bench Read -benchmem >> output.txt
go test . -bench Write -benchmem >> output.txt
go test . -bench AlphaField -benchmem >> output.txt
go test . -bench NumericField -benchmem >> output.txt
go test . -bench ParseNumField -benchmem >> output.txt
go test . -bench ParseStringField -benchmem >> output.txt
go test . -bench BenchmarkMergeFiles -benchmem >> output.txt
go test . -bench BenchmarkCalculateCheckDigit -benchmem >> output.txt
go test ./server/ -bench Benchmark -benchmem >> output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: My Project Go Benchmark
tool: 'go'
output-file-path: ./ach/output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-fetch-gh-pages: true
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '120%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@adamdecaf'
# Update files on master branch
gh-pages-branch: master
benchmark-data-dir-path: docs/bench/ach/
benchmark:
uses: moov-io/benchmarks/.github/workflows/bench.yml@master
secrets: inherit
needs: manifest
with:
name: ach
command: |
go test . -bench BenchmarkBuildFile -benchmem > output.txt
go test . -bench Read -benchmem >> output.txt
go test . -bench Write -benchmem >> output.txt
go test . -bench AlphaField -benchmem >> output.txt
go test . -bench NumericField -benchmem >> output.txt
go test . -bench ParseNumField -benchmem >> output.txt
go test . -bench ParseStringField -benchmem >> output.txt
go test . -bench BenchmarkMergeFiles -benchmem >> output.txt
go test . -bench BenchmarkCalculateCheckDigit -benchmem >> output.txt
57 changes: 57 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Benchmarks
on:
workflow_call:
inputs:
name:
required: true
type: string
command:
required: true
type: string

permissions:
deployments: write
contents: write

jobs:
run:
name: Run
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
with:
repository: 'moov-io/benchmarks'

- uses: actions/checkout@v4
with:
repository: moov-io/{{inputs.name}}
path: ./{{inputs.name}}}/

- uses: actions/setup-go@v5
with:
go-version: "stable"

- name: moov-io/{{inputs.name}}
run: |
cd ./{{inputs.name}}/
{{inputs.command}}
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: moov-io/{{inputs.name}}
tool: 'go'
output-file-path: ./{{inputs.name}}/output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-fetch-gh-pages: true
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '120%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@adamdecaf'
# Update files on master branch
gh-pages-branch: master
benchmark-data-dir-path: docs/bench/{{inputs.name}}/

0 comments on commit 35b56ac

Please sign in to comment.