feat: continue node binding #136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize] | |
paths-ignore: | |
- "**/*.md" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
benchmark: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] # `macos-latest` is too unstable to be useful for benchmark, the variance is always huge. | |
name: Run benchmark on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: stable | |
- name: Run Bench on main Branch | |
run: | | |
cargo bench --bench codec_benchmarks --features bench -- --save-baseline main | |
cargo bench --bench array_ops_benchmarks --features bench -- --save-baseline main | |
cargo bench --bench map_ops_benchmarks --features bench -- --save-baseline main | |
cargo bench --bench text_ops_benchmarks --features bench -- --save-baseline main | |
cargo bench --bench update_benchmarks --features bench -- --save-baseline main | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
clean: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Run Bench on PR Branch | |
run: | | |
cargo bench --bench codec_benchmarks --features bench -- --save-baseline pr | |
cargo bench --bench array_ops_benchmarks --features bench -- --save-baseline pr | |
cargo bench --bench map_ops_benchmarks --features bench -- --save-baseline pr | |
cargo bench --bench text_ops_benchmarks --features bench -- --save-baseline pr | |
cargo bench --bench update_benchmarks --features bench -- --save-baseline pr | |
- name: Upload benchmark results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: benchmark-results-${{ matrix.os }} | |
path: ./target/criterion | |
benchmark-compare: | |
runs-on: ubuntu-latest | |
name: Compare Benchmarks | |
needs: | |
- benchmark | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
toolchain: stable | |
- name: Install critcmp | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: critcmp | |
- name: Linux | Download PR benchmark results | |
uses: actions/download-artifact@v3 | |
with: | |
name: benchmark-results-ubuntu-latest | |
path: ./target/criterion | |
- name: Linux | Compare benchmark results | |
shell: bash | |
run: | | |
critcmp main pr | cargo run -p y-octo-utils --bin bench_result_render --features bench -- Linux >> summary.md | |
echo "" >> summary.md | |
- name: Linux | Cleanup benchmark results | |
run: rm -rf ./target/criterion | |
- name: Windows | Download PR benchmark results | |
uses: actions/download-artifact@v3 | |
with: | |
name: benchmark-results-windows-latest | |
path: ./target/criterion | |
- name: Windows | Compare benchmark results | |
shell: bash | |
run: | | |
critcmp main pr | cargo run -p y-octo-utils --bin bench_result_render --features bench -- Windows >> summary.md | |
cat summary.md > $GITHUB_STEP_SUMMARY | |
- name: Find Comment | |
# Check if the event is not triggered by a fork | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: "github-actions[bot]" | |
body-includes: Benchmark Results | |
- name: Create or update comment | |
# Check if the event is not triggered by a fork | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
edit-mode: replace | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
body-file: summary.md |