Skip to content

Feat/ci benchmark

Feat/ci benchmark #23

Workflow file for this run

name: Bench Go
on:
push:
branches:
- 'main'
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
benchmarks:
name: Run Go benchmarks
runs-on: codspeed-macro
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: true
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: '1.26.0'
cache: false
- name: Preinstall perf
shell: bash
run: |
if command -v perf >/dev/null 2>&1; then
perf --version
exit 0
fi
. /etc/os-release
sudo apt-get update
case "$ID" in
debian)
sudo apt-get install -y linux-perf
;;
ubuntu)
sudo apt-get install -y \
linux-tools-common \
linux-tools-generic \
"linux-tools-$(uname -r)"
;;
*)
echo "unsupported distro for perf install: $ID" >&2
exit 1
;;
esac
perf --version
- name: Run benchmarks
uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2
with:
mode: walltime
run: go test -bench=. -benchtime=5s ./internal/linter/ ./cmd/rslint