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

Use canbench for CI #525

Merged
merged 14 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
55 changes: 46 additions & 9 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,64 @@ jobs:
runBenchMark:
name: run benchmark
runs-on: ubuntu-latest
env:
RUSTC_VERSION: 1.75.0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Checkout base branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.base_ref }}
path: main/
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: ${{ env.RUSTC_VERSION }}
override: true
target: wasm32-unknown-unknown
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-bench-${{ hashFiles('**/Cargo.lock') }}
- uses: boa-dev/criterion-compare-action@master
- name: Install canbench
run: cargo install canbench
- name: Run perf for base branch
if: false
run: |
pushd main/rust/bench
canbench --persist
popd
cp main/rust/bench/canbench_results.yml rust/bench/
- name: Run perf for PR beanch
run: |
pushd rust/bench
canbench --less-verbose --persist > /tmp/perf.txt
python diff.py > /tmp/table.md
{
cat /tmp/table.md
echo "<details><summary>Click to see raw report</summary>"
echo
echo "\`\`\`"
cat /tmp/perf.txt
echo "\`\`\`"
echo "</details>"
} > /tmp/message.txt
- name: Post comment
uses: thollander/actions-comment-pull-request@v2
with:
cwd: rust/candid
benchName: benchmark # needed to address https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
filePath: /tmp/message.txt
comment_tag: canbench

4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -18,7 +18,7 @@ jobs:
override: true
components: rustfmt, clippy
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
.canbench/

# IDEs
.idea/
Expand Down
Loading
Loading