surrealpatch/.github/workflows/bench.yml
2023-05-30 19:44:47 +01:00

52 lines
1.4 KiB
YAML

name: Benchmark
on:
push:
pull_request:
defaults:
run:
shell: bash
jobs:
bench:
name: Bench library
runs-on: ubuntu-latest
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get -qq -y update
sudo apt-get -qq -y install protobuf-compiler libprotobuf-dev
cargo install --quiet critcmp
- name: Checkout baseline
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Benchmark baseline
run: cargo bench --quiet --package surrealdb --no-default-features --features kv-mem,scripting,http -- --save-baseline baseline
- name: Extract baseline
run: cp -r target/criterion /tmp/criterion
- name: Checkout changes
uses: actions/checkout@v3
- name: Replace baseline
run: mkdir target && cp -r /tmp/criterion target/criterion
- name: Benchmark changes
run: cargo bench --quiet --package surrealdb --no-default-features --features kv-mem,scripting,http -- --save-baseline changes
- name: Compare results
run: critcmp baseline changes | tee benchmark_results
- name: Save results as artifact
uses: actions/upload-artifact@v1
with:
name: Benchmark Results
path: benchmark_results