Skip to content

🎉 os-11.2.33 (#4753) #835

🎉 os-11.2.33 (#4753)

🎉 os-11.2.33 (#4753) #835

name: Benchmark main
## Only trigger tests if source is changing
on:
push:
branches:
- main
paths:
- '**.go'
- '**.mod'
- 'go.sum'
- .github/workflows/main-benchmark.yml
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
go-bench:
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ">=${{ env.golang-version }}"
cache: false
- name: Run benchmark
run: make benchmark/go | tee benchmark.txt
# Remove log statements and leave just the benchmark results
- name: Cleanup benchmark file
run: sed -i -n '/goos:/,$p' benchmark.txt
# Download previous benchmark result from cache (if exists)
- name: Download previous benchmark data
uses: actions/cache/restore@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-benchmark-
# Run `github-action-benchmark` action
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the output.txt came from
tool: 'go'
# Where the output from the benchmark tool is stored
output-file-path: benchmark.txt
# Where the previous data file is stored
external-data-json-path: ./cache/benchmark-data.json
save-data-file: true
- name: Save benchmark data
uses: actions/cache/save@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark-${{ github.run_id }}