name: Benchmark on: push: branches: [master] pull_request: branches: [master] types: [opened, reopened, synchronize] jobs: Benchmark: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Update rust run: rustup toolchain update stable - name: Run benchmarks run: cargo bench -- -R bencher | tee output.txt - name: Download base benchmark uses: actions/cache@v1 with: path: ./cache key: ${{ runner.os }}-benchmark-${{ github.ref }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-benchmark-${{ github.ref }}-${{ github.sha }} ${{ runner.os }}-benchmark-${{ github.ref }} ${{ runner.os }}-benchmark - name: Compare benchmarks for Pull Requests uses: rhysd/github-action-benchmark@v1 if: github.event_name == 'pull_request' with: tool: cargo output-file-path: output.txt external-data-json-path: ./cache/benchmark-data.json github-token: ${{ github.token }} comment-always: true save-data-file: false - name: Compare benchmarks for master branch uses: rhysd/github-action-benchmark@v1 if: github.event_name == 'push' with: tool: cargo output-file-path: output.txt external-data-json-path: ./cache/benchmark-data.json github-token: ${{ github.token }} alert-threshold: 125% comment-on-alert: true