⚡ discover assets in parallel (#4973) #958
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |