trunk.yml

 1# //.github/workflows:trunk.yml
 2#
 3# This file exists to define the steps executed for a push to the default tree.
 4# For configuring the steps that occur after a push to all other branches under
 5# the refs/heads namespace, see `//.github/workflows:presubmit.yml`.
 6---
 7name: trunk
 8
 9on:
10  push:
11    branches:
12      - master
13
14concurrency:
15  group: ${{ github.ref }}
16  cancel-in-progress: true
17
18jobs:
19  lint:
20    uses: ./.github/workflows/lint.yml
21
22  build-and-test:
23    uses: ./.github/workflows/build-and-test.yml
24    secrets: inherit
25
26  benchmark:
27    runs-on: ubuntu-latest
28    permissions:
29      contents: write
30      deployments: write
31    steps:
32      - uses: actions/setup-go@v5
33        with:
34          go-version: 1.24.2
35
36      - uses: actions/checkout@v4
37
38      - name: Run benchmark
39        run: go test -v ./... -bench=. -run=xxx -benchmem | tee output.txt
40
41      - name: Store benchmark result
42        uses: benchmark-action/github-action-benchmark@v1
43        with:
44          tool: 'go'
45          output-file-path: output.txt
46          github-token: ${{ secrets.GITHUB_TOKEN }}
47          comment-on-alert: true
48          auto-push: true