clap/.github/workflows/benchmark.yml

58 lines
1.7 KiB
YAML
Raw Normal View History

2020-03-14 14:05:10 +00:00
name: Benchmark
2020-03-05 01:20:05 +00:00
on:
pull_request:
branches: [master]
types: [opened, reopened, synchronize]
jobs:
Benchmark:
runs-on: ubuntu-latest
steps:
2020-04-10 10:31:46 +00:00
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Checkout base
2020-03-05 01:20:05 +00:00
uses: actions/checkout@v2
2020-04-10 10:31:46 +00:00
with:
ref: master
2020-04-20 09:09:48 +00:00
- name: Ready cache
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
2020-04-10 10:31:46 +00:00
- name: Cache cargo
2020-03-05 01:20:05 +00:00
uses: actions/cache@v1
2020-04-20 09:09:48 +00:00
id: cache
2020-03-05 01:20:05 +00:00
with:
2020-04-20 09:09:48 +00:00
path: ~/.cargo
2020-04-10 10:31:46 +00:00
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Bench base
run: cargo bench -- -R bencher | tee output.txt
- name: Save base benchmark
uses: pksunkara/github-action-benchmark@v1
2020-03-05 01:20:05 +00:00
with:
tool: cargo
output-file-path: output.txt
2020-04-10 10:31:46 +00:00
external-data-json-path: ./benchmark-data.json
read-commit-id: true
- name: Checkout pull request
uses: actions/checkout@v2
with:
clean: false
- name: Bench pull request
run: cargo bench -- -R bencher | tee output.txt
- name: Compare benchmarks
2020-04-13 00:36:08 +00:00
uses: pksunkara/github-action-benchmark@v2
2020-03-14 14:05:10 +00:00
with:
tool: cargo
output-file-path: output.txt
2020-04-10 10:31:46 +00:00
external-data-json-path: ./benchmark-data.json
2020-03-14 14:05:10 +00:00
github-token: ${{ github.token }}
2020-04-13 00:36:08 +00:00
annotate-always: true
- name: Install cargo-cache
uses: actions-rs/install@v0.1
2020-04-20 09:09:48 +00:00
if: steps.cache.outputs.cache-hit != 'true'
2020-04-13 00:36:08 +00:00
with:
crate: cargo-cache
use-tool-cache: true
2020-04-10 10:31:46 +00:00
- name: Cleanup cache
2020-04-20 09:09:48 +00:00
if: steps.cache.outputs.cache-hit != 'true'
2020-04-13 00:36:08 +00:00
run: cargo cache -a