|
| 1 | +name: CodSpeed Benchmarks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + # renovate: datasource=github-releases depName=codspeed packageName=CodSpeedHQ/runner |
| 12 | + CODSPEED_RUNNER_VERSION: v4.3.4 |
| 13 | + |
| 14 | +jobs: |
| 15 | + benchmarks: |
| 16 | + name: Run benchmarks |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 20 | + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
| 21 | + - name: Setup Go |
| 22 | + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
| 23 | + with: |
| 24 | + go-version: stable |
| 25 | + cache: false |
| 26 | + - name: Cache Go |
| 27 | + id: go-cache |
| 28 | + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 |
| 29 | + with: |
| 30 | + path: | |
| 31 | + ~/go/bin |
| 32 | + ~/go/pkg/mod |
| 33 | + key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }} |
| 34 | + |
| 35 | + # The following comes from https://github.com/CodSpeedHQ/action/blob/6a8e2b/action.yml with significant modifications. |
| 36 | + # Copyright (c) 2022 CodSpeed and contributors |
| 37 | + # TODO: Switch to a setup-codspeed action when available, see https://github.com/CodSpeedHQ/action/issues/146 |
| 38 | + - name: Determine kernel version |
| 39 | + id: versions |
| 40 | + shell: bash |
| 41 | + run: | |
| 42 | + # Get kernel version for cache key |
| 43 | + KERNEL_VERSION=$(uname -r) |
| 44 | + echo "kernel-version=$KERNEL_VERSION" >> $GITHUB_OUTPUT |
| 45 | + - name: Cache CodSpeed instruments |
| 46 | + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 |
| 47 | + with: |
| 48 | + path: ~/.cache/codspeed-action |
| 49 | + key: codspeed-instruments-instrumentation-${{ runner.os }}-${{ runner.arch }}-${{steps.versions.outputs.kernel-version }}-${{ env.CODSPEED_RUNNER_VERSION }} |
| 50 | + restore-keys: | |
| 51 | + codspeed-instruments-instrumentation-${{ runner.os }}-${{ runner.arch }}-${{steps.versions.outputs.kernel-version }}-${{ env.CODSPEED_RUNNER_VERSION }} |
| 52 | + # TODO: curl -fsSL https://github.com/CodSpeedHQ/runner/releases/download/${{ env.CODSPEED_RUNNER_VERSION }}/codspeed-runner-installer.sh | bash -s -- --quiet |
| 53 | + - name: Setup codspeed |
| 54 | + run: | |
| 55 | + cargo install --git https://github.com/CodSpeedHQ/codspeed-go/ --branch cod-1666-codspeed-go-is-unable-to-run-benchmarks-on-go-modules-with |
| 56 | + - name: Run benchmarks |
| 57 | + run: | |
| 58 | + make for-all-target TARGET="codspeed-benchmark" |
| 59 | +
|
0 commit comments