File
Blob: .github/workflows/codspeed.yml
| 1 | name: CodSpeed |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | paths-ignore: |
| 6 | - 'docs/**' |
| 7 | - 'justfile' |
| 8 | - '.devcontainer' |
| 9 | - '**/*.md' |
| 10 | - '.gitignore' |
| 11 | merge_group: |
| 12 | push: |
| 13 | branches: |
| 14 | - main |
| 15 | |
| 16 | concurrency: |
| 17 | group: codspeed.yml-${{ github.event.pull_request.number || github.run_id }} |
| 18 | cancel-in-progress: true |
| 19 | |
| 20 | permissions: |
| 21 | # Write cache |
| 22 | contents: write |
| 23 | |
| 24 | jobs: |
| 25 | benchmarks: |
| 26 | name: Run benchmarks |
| 27 | runs-on: ubuntu-22.04-16core |
| 28 | env: |
| 29 | BAZEL_ARGS: --config=benchmark --@google_benchmark//:codspeed_mode=simulation --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev |
| 30 | steps: |
| 31 | - uses: actions/checkout@v6 |
| 32 | with: |
| 33 | show-progress: false |
| 34 | |
| 35 | - name: Cache |
| 36 | id: cache |
| 37 | uses: actions/cache@v5 |
| 38 | with: |
| 39 | path: ~/bazel-disk-cache |
| 40 | key: bazel-disk-cache-benchmarks-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel') }} |
| 41 | |
| 42 | - name: Setup Runner |
| 43 | uses: ./.github/actions/setup-runner |
| 44 | with: |
| 45 | GOOGLESOURCE_COOKIE: ${{ secrets.GOOGLESOURCE_COOKIE }} |
| 46 | |
| 47 | - name: Build benchmarks |
| 48 | run: | |
| 49 | bazel build ${{ env.BAZEL_ARGS }} --build_tag_filters=google_benchmark //... @capnp-cpp//... |
| 50 | |
| 51 | - name: Generate benchmark script |
| 52 | run: | |
| 53 | echo '#!/bin/bash' > run_benchmarks.sh |
| 54 | echo 'set -ex' >> run_benchmarks.sh |
| 55 | targets=$(bazel query 'attr(tags, "[\[ ]google_benchmark[,\]]", //... + @capnp-cpp//...) except attr(tags, "[\[ ]manual[,\]]", //...)' --output=label 2>/dev/null) |
| 56 | for target in $targets; do |
| 57 | echo "echo 'Running benchmark: $target'" >> run_benchmarks.sh |
| 58 | echo "bazel run ${{ env.BAZEL_ARGS }} $target -- --benchmark_min_time=1s" >> run_benchmarks.sh |
| 59 | done |
| 60 | chmod +x run_benchmarks.sh |
| 61 | |
| 62 | - name: Run benchmarks |
| 63 | uses: CodSpeedHQ/action@v4 |
| 64 | with: |
| 65 | mode: simulation |
| 66 | run: ./run_benchmarks.sh |
| 67 | |
| 68 | - name: Bazel shutdown |
| 69 | run: bazel shutdown |