name: Benchmark on: pull_request: branches: [master] types: [opened, reopened, synchronize] jobs: Benchmark: runs-on: ubuntu-latest steps: - name: Install rust uses: actions-rs/toolchain@v1 with: toolchain: stable - name: Checkout base uses: actions/checkout@v2 with: ref: master - name: Cache cargo uses: actions/cache@v1 with: path: ~/.cargo 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 with: tool: cargo output-file-path: output.txt 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 uses: pksunkara/github-action-benchmark@v1 with: tool: cargo output-file-path: output.txt external-data-json-path: ./benchmark-data.json github-token: ${{ github.token }} comment-always: true - name: Cleanup cache run: rm -rf ~/.cargo/registry/src