Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: add bench action #173

Merged
merged 20 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 22 additions & 58 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Do not run this workflow on pull request since this workflow has permission to modify contents.
on:
workflow_dispatch:
inputs:
reason:
description: 'reason to trigger this build'
required: false

push:
branches:
- master

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

name: Bench

jobs:
Expand All @@ -26,55 +31,14 @@ jobs:
with:
toolchain: nightly
default: true
- uses: actions-rs/cargo@v1
name: Benchmark 🚀
with:
command: bench
args: --all-features --workspace
sanitizer_bench:
name: Bench with Sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout 🛎️
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-sanitizer-bench
- uses: actions-rs/toolchain@v1
name: Setup Cargo Toolchain 🛎️
with:
components: rust-src
toolchain: nightly
default: true
- uses: actions-rs/cargo@v1
name: Bench with Address Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=address"
- uses: actions-rs/cargo@v1
name: Bench with Leak Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=leak"
- uses: actions-rs/cargo@v1
name: Bench with Memory Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=memory"
- uses: actions-rs/cargo@v1
name: Bench with Thread Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=thread"
- name: Benchmark 🚀
run: cargo +nightly bench --all-features --workspace -- --output-format bencher | tee output.txt
GanZiheng marked this conversation as resolved.
Show resolved Hide resolved
- uses: benchmark-action/github-action-benchmark@v1
name: Store benchmark result
with:
tool: "cargo"
output-file-path: output.txt
# Access token to deploy GitHub Pages branch
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: true
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ incremental = false
debug-assertions = false
overflow-checks = false
rpath = false

[lib]
bench = false
GanZiheng marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ prost = "0.8"

[build-dependencies]
prost-build = { version = "0.8" }

[lib]
bench = false
3 changes: 3 additions & 0 deletions skiplist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ tikv-jemallocator = "0.4.0"
[[bench]]
name = "bench"
harness = false

[lib]
bench = false