clap/.github/workflows/benchmark.yml

67 lines
2 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:
2020-11-28 00:50:18 +00:00
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
benchmark:
name: Benchmark
needs: [prepare]
2020-03-05 01:20:05 +00:00
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
2020-04-25 19:21:54 +00:00
run: cargo bench -- --output-format bencher | tee output.txt
2020-04-10 10:31:46 +00:00
- 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
2020-04-25 19:21:54 +00:00
run: cargo bench -- --output-format bencher | tee output.txt
2020-04-10 10:31:46 +00:00
- 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