name: Automation - Performance

on:
  push:
    branches: [main]

permissions: read-all

jobs:
  runperf:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Setup Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: oldstable
          cache: false

      - name: Cache Go
        id: go-cache
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: |
            ~/go/bin
            ~/go/pkg/mod
          key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}

      - name: Run benchmark
        run: make gobenchmark

      # Disabling until fine-grained permissions token enabled for the
      # repository
      #- name: Store benchmark result
      #  uses: benchmark-action/github-action-benchmark@v1
      #  with:
      #    tool: 'go'
      #    output-file-path: benchmarks.txt
      #    gh-pages-branch: gh-pages
      #    auto-push: true
      #    github-token: ${{ secrets.GITHUB_TOKEN }}
      #    benchmark-data-dir-path: "docs/dev/bench"
