2021-05-26 11:01:53 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
name: Benchmark
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
benchmark:
|
2021-06-04 14:45:18 +00:00
|
|
|
name: Cargo benchmark
|
2021-05-26 11:01:53 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: cargo-${{ runner.os }}-bench-${{ hashFiles('**/Cargo.toml') }}
|
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
- name: Run benchmarks
|
|
|
|
run: |
|
|
|
|
for bench in call dict gil list pyclass pyobject set tuple; do
|
|
|
|
cargo bench --features hashbrown --bench "bench_$bench" -- --output-format bencher | tee -a output.txt
|
|
|
|
done
|
|
|
|
|
|
|
|
# Download previous benchmark result from cache (if exists)
|
|
|
|
- name: Download previous benchmark data
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ./cache
|
|
|
|
key: ${{ runner.os }}-benchmark
|
|
|
|
|
|
|
|
# Run `github-action-benchmark` action
|
|
|
|
- name: Store benchmark result
|
|
|
|
uses: rhysd/github-action-benchmark@v1
|
|
|
|
with:
|
|
|
|
name: pyo3-bench
|
|
|
|
# What benchmark tool the output.txt came from
|
2021-07-19 19:56:43 +00:00
|
|
|
tool: "cargo"
|
2021-05-26 11:01:53 +00:00
|
|
|
# Where the output from the benchmark tool is stored
|
|
|
|
output-file-path: output.txt
|
|
|
|
# GitHub API token to make a commit comment
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
auto-push: ${{ github.event_name != 'pull_request' }}
|
2021-06-04 14:45:18 +00:00
|
|
|
|
|
|
|
pytest-benchmark:
|
|
|
|
name: pytest benchmark
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: cargo-${{ runner.os }}-pytest-bench-${{ hashFiles('**/Cargo.toml') }}
|
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
- name: Download previous benchmark data
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ./cache
|
|
|
|
key: ${{ runner.os }}-pytest-benchmark
|
|
|
|
|
|
|
|
- name: Run benchmarks
|
|
|
|
run: |
|
|
|
|
cd examples/pyo3-benchmarks
|
|
|
|
python -m pip install -r requirements-dev.txt
|
|
|
|
python setup.py develop
|
|
|
|
pytest --benchmark-json ../../output.json
|
|
|
|
- name: Store benchmark result
|
|
|
|
uses: rhysd/github-action-benchmark@v1
|
|
|
|
with:
|
|
|
|
name: pytest-bench
|
2021-07-19 19:56:43 +00:00
|
|
|
tool: "pytest"
|
2021-06-04 14:45:18 +00:00
|
|
|
output-file-path: output.json
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
auto-push: ${{ github.event_name != 'pull_request' }}
|