From 119329f7065160efc663e6daf4fa121ce4312bce Mon Sep 17 00:00:00 2001 From: Brian Ginsburg Date: Thu, 23 Jan 2025 12:51:26 -0800 Subject: [PATCH] test: Add benchmark GH action --- .github/workflows/bench.yml | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/bench.yml diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 00000000..fe4f74b0 --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,61 @@ +name: Benchmarks + +on: + # pull_request: + # branches: + # - main + push: + branches: + - bgins/feat-add-matching-sorts + +permissions: + deployments: write + contents: write + +jobs: + run-solver-benchmarks: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install golang + uses: actions/setup-go@v5 + + - name: Run benchmarks + run: ./stack benchmarks-solver | tee assets/benchmark-output.txt + + - name: Download previous benchmark data + uses: actions/cache@v4 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + + - name: Log conditions + run: | + echo event_name: ${{ github.event_name }} + echo ref_name: ${{ github.ref_name }} + + + + - name: Store benchmark results + # if: github.event_name == 'pull_request' + if: github.event_name == 'push' && github.ref_name == 'bgins/feat-add-matching-sorts' + uses: benchmark-action/github-action-benchmark@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + tool: 'go' + output-file-path: assets/benchmark-output.txt + external-data-json-path: ./cache/benchmark-data.json + comment-on-alert: true + summary-always: true + auto-push: false + + # - name: Publish benchmark results + # if: github.event_name == 'push' && github.ref_name == 'main' + # uses: benchmark-action/github-action-benchmark@v1 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # tool: 'go' + # output-file-path: assets/benchmark-output.txt + # auto-push: true