2022-01-13 17:06:35 -05:00
|
|
|
name: "Minimal Continuous Benchmark"
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
# The branches below must be a subset of the branches above
|
|
|
|
branches: [main]
|
|
|
|
|
2022-07-11 14:54:49 -05:00
|
|
|
permissions: read-all
|
|
|
|
|
2022-01-13 17:06:35 -05:00
|
|
|
jobs:
|
|
|
|
benchmark:
|
|
|
|
name: Performance regression check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-07-13 16:15:33 -05:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v3
|
2022-01-13 17:06:35 -05:00
|
|
|
with:
|
2022-10-05 05:21:14 -05:00
|
|
|
go-version: 1.19.x
|
2022-01-13 17:06:35 -05:00
|
|
|
# Run benchmark with `go test -bench` and stores the output to a file
|
|
|
|
- name: Run benchmark
|
|
|
|
run: make BENCH_OUTPUT=ci-cd run-bench
|
|
|
|
# Download previous benchmark result from cache (if exists)
|
|
|
|
- name: Download previous benchmark data
|
2022-07-13 16:15:33 -05:00
|
|
|
uses: actions/cache@v3
|
2022-01-13 17:06:35 -05:00
|
|
|
with:
|
|
|
|
path: ./cache
|
2022-08-30 10:38:56 -05:00
|
|
|
key: ${{ runner.os }}-gen1-benchmark
|
2022-01-13 17:06:35 -05:00
|
|
|
# Run `github-action-benchmark` action
|
|
|
|
- name: Store benchmark result
|
2022-11-08 03:39:06 -05:00
|
|
|
uses: benchmark-action/github-action-benchmark@v1.15.0
|
2022-01-13 17:06:35 -05:00
|
|
|
with:
|
|
|
|
# What benchmark tool the output.txt came from
|
|
|
|
tool: 'customBiggerIsBetter'
|
|
|
|
# Where the output from the benchmark tool is stored
|
|
|
|
output-file-path: ci-cd.json
|
|
|
|
# Where the previous data file is stored
|
|
|
|
external-data-json-path: ./cache/benchmark-data.json
|
|
|
|
# Workflow will fail when an alert happens
|
|
|
|
fail-on-alert: true
|
|
|
|
# Upload the updated cache file for the next job by actions/cache
|