name: bench

on: [push]

permissions:
  # deployments permission to deploy GitHub pages website
  deployments: write
  # contents permission to update benchmark contents in gh-pages branch
  contents: write

jobs:
  bench:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: hecrj/setup-rust-action@master
        with:
          rust-version: nightly

      - name: benchmark
        run: cargo bench | tee output.txt

      - name: Store benchmark result
        uses: rhysd/github-action-benchmark@v1
        with:
          tool: "cargo"
          output-file-path: output.txt
          github-token: ${{ secrets.GITHUB_TOKEN }}
          auto-push: true
