-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,38 @@ | ||
name: benches | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "main" | ||
pull_request: | ||
|
||
name: Benchmark | ||
# `workflow_dispatch` allows CodSpeed to trigger backtest | ||
# performance analysis in order to generate initial data. | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | ||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}-benches | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
benchmark: | ||
name: Benchmark | ||
benchmarks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- name: Cache cargo build | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Run benchmark | ||
run: | | ||
cargo bench --all-features --bench jieba_benchmark -- --output-format bencher | tee output.txt | ||
components: rust-src | ||
|
||
# Download previous benchmark result from cache (if exists) | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v1 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
- uses: Swatinem/rust-cache@v2 | ||
continue-on-error: true | ||
|
||
- name: Install cargo-codspeed | ||
run: cargo install cargo-codspeed | ||
|
||
- name: Build the benchmark target(s) | ||
run: cargo codspeed build --all-features | ||
|
||
# Run `github-action-benchmark` action | ||
- name: Store benchmark result | ||
uses: rhysd/github-action-benchmark@v1 | ||
- name: Run the benchmarks | ||
uses: CodSpeedHQ/action@v2 | ||
with: | ||
name: jieba_benchmark | ||
# What benchmark tool the output.txt came from | ||
tool: 'cargo' | ||
# Where the output from the benchmark tool is stored | ||
output-file-path: output.txt | ||
# # Where the previous data file is stored | ||
# external-data-json-path: ./cache/benchmark-data.json | ||
# Workflow will fail when an alert happens | ||
fail-on-alert: true | ||
# GitHub API token to make a commit comment | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# Enable alert commit comment | ||
comment-on-alert: true | ||
alert-comment-cc-users: '@messense' | ||
auto-push: true | ||
run: cargo codspeed run --all-features | ||
token: ${{ secrets.CODSPEED_TOKEN }} |
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
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