Skip to content

Commit

Permalink
Use canbench for CI (#525)
Browse files Browse the repository at this point in the history
* use canbench

* ci

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix
  • Loading branch information
chenyan-dfinity authored Feb 20, 2024
1 parent 7c4de8c commit 0219c2d
Show file tree
Hide file tree
Showing 16 changed files with 3,438 additions and 546 deletions.
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

0 comments on commit 0219c2d

Please sign in to comment.