2023-05-01 17:15:42 +00:00
|
|
|
name: Benchmark
|
|
|
|
|
2023-05-30 18:44:47 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
2023-05-01 17:15:42 +00:00
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
bench:
|
|
|
|
name: Bench library
|
2023-05-30 18:44:47 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-05-01 17:15:42 +00:00
|
|
|
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
|
2023-05-16 22:31:30 +00:00
|
|
|
run: cargo bench --quiet --package surrealdb --no-default-features --features kv-mem,scripting,http -- --save-baseline baseline
|
2023-05-01 17:15:42 +00:00
|
|
|
|
2023-05-02 08:28:36 +00:00
|
|
|
- name: Extract baseline
|
|
|
|
run: cp -r target/criterion /tmp/criterion
|
|
|
|
|
2023-05-01 17:15:42 +00:00
|
|
|
- name: Checkout changes
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2023-05-02 08:28:36 +00:00
|
|
|
- name: Replace baseline
|
|
|
|
run: mkdir target && cp -r /tmp/criterion target/criterion
|
|
|
|
|
2023-05-01 17:15:42 +00:00
|
|
|
- name: Benchmark changes
|
2023-05-16 22:31:30 +00:00
|
|
|
run: cargo bench --quiet --package surrealdb --no-default-features --features kv-mem,scripting,http -- --save-baseline changes
|
2023-05-01 17:15:42 +00:00
|
|
|
|
|
|
|
- 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
|