Skip to content

ci: enable bench

ci: enable bench #631

Workflow file for this run

name: ci
on: ["push", "pull_request"]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- run: make all
- uses: dominikh/[email protected]
with:
version: "2023.1.3"
install-go: false
- name: Verify repo is up-to-date
run: |
if [ -n "$(git status --porcelain)" ]; then
echo 'Updates required:'
git diff
exit 1
fi
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: Run tests
run: make test
run-benchdiff:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
# Version: https://github.com/WillAbides/benchdiff-action/releases/tag/v0.3.3
- uses: WillAbides/benchdiff-action@4d1d267fa96763646dd7c0d58e242817ce392c61
id: benchdiff
continue-on-error: true
with:
benchdiff_version: 0.9.1
status_sha: ${{ github.sha }}
status_name: benchdiff-result
status_on_degraded: neutral
# See https://github.com/WillAbides/benchdiff
benchdiff_args: |
--base-ref=origin/main
--cpu=1,2
--count=5
--warmup-count=1
--warmup-time=10ms
--benchtime=100ms
--tolerance=20
--benchmem
--debug
- name: Notify benchdiff with a GitHub comment
continue-on-error: true
uses: actions/github-script@v6
with:
script: |
console.log(`Repo ${context.repo.repo}`)
console.log(`Issue ${context.issue.number}`)
const body = `## Benchdiff
Command: \`${{ steps.benchdiff.outputs.bench_command }}\`
HEAD: ${{ steps.benchdiff.outputs.head_sha }}
Base: ${{ steps.benchdiff.outputs.base_sha }}
Degraded: ${{ steps.benchdiff.outputs.degraded_result }}
<details>
<summary>Results</summary>
${{ steps.benchdiff.outputs.benchstat_output }}
</details>
`.replace(/ +/g, '')
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Notify benchdiff with a GitHub summary
continue-on-error: true
uses: actions/github-script@v6
with:
script: |
await core.summary
.addHeading('Benchdiff')
.addDetails('Results', '${{ steps.benchdiff.outputs.benchstat_output }}')
.write()