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      - trunk
13
14concurrency:
15  group: ${{ github.ref }}
16  cancel-in-progress: true
17
18permissions:
19  contents: read
20
21jobs:
22  build-and-test:
23    uses: ./.github/workflows/build-and-test.yml
24    secrets:
25      github-test-token: ${{ secrets.TEST_TOKEN_GITHUB }}
26      github-token-private: ${{ secrets._GITHUB_TOKEN_PRIVATE }}
27      github-token-public: ${{ secrets._GITHUB_TOKEN_PUBLIC }}
28      gitlab-api-token: ${{ secrets.GITLAB_API_TOKEN }}
29      gitlab-project-id: ${{ secrets.GITLAB_PROJECT_ID }}
30
31  benchmark:
32    runs-on: ubuntu-latest
33    permissions:
34      contents: write
35      deployments: write
36    steps:
37      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38        with:
39          persist-credentials: false
40
41      - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
42        with:
43          go-version: 1.24.2
44
45      - name: Run benchmark
46        run: go test -v ./... -bench=. -run=xxx -benchmem | tee output.txt
47
48      - name: Store benchmark result
49        uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
50        with:
51          tool: 'go'
52          output-file-path: output.txt
53          github-token: ${{ secrets.GITHUB_TOKEN }}
54          comment-on-alert: true
55          auto-push: true