Migrate deprecated scheme.Builder #746
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Cluster Autoscaler Benchmark | |
| on: | |
| pull_request: | |
| paths: | |
| - 'cluster-autoscaler/**' | |
| permissions: | |
| contents: read | |
| jobs: | |
| benchmark: | |
| name: Run and Compare Benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| path: pr | |
| - name: Checkout Base | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: ${{ github.event.pull_request.base.ref }} | |
| path: base | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: pr/cluster-autoscaler/go.mod | |
| cache-dependency-path: pr/cluster-autoscaler/go.sum | |
| - name: Apt-get dependencies | |
| run: sudo apt-get install libseccomp-dev -qq | |
| - name: Run Benchmark (Base) | |
| shell: bash | |
| run: | | |
| cd base/cluster-autoscaler | |
| go test -v -bench=BenchmarkRunOnce -benchmem -count=6 ./core/bench/... -args -gc true | tee ../../base.txt | |
| - name: Run Benchmark (PR) | |
| shell: bash | |
| run: | | |
| cd pr/cluster-autoscaler | |
| go test -v -bench=BenchmarkRunOnce -benchmem -count=6 ./core/bench/... -args -gc true | tee ../../pr.txt | |
| - name: Install benchstat | |
| run: go install golang.org/x/perf/cmd/benchstat@latest | |
| - name: Compare Results | |
| shell: bash | |
| # Do not block valid PRs on benchmark issues as we are still stabilizing. | |
| continue-on-error: true | |
| run: | | |
| echo "### Cluster Autoscaler Benchmark Results" >> $GITHUB_STEP_SUMMARY | |
| echo "Comparing PR branch against \`${{ github.event.pull_request.base.ref }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -s base.txt ] && [ -s pr.txt ]; then | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| $(go env GOPATH)/bin/benchstat base.txt pr.txt | tee benchstat.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| # Fail if any regression is > 10% | |
| grep -qE '\+[1-9][0-9].*%' benchstat.txt && { echo "Regression detected > 10%"; exit 1; } || true | |
| else | |
| echo "Error: Benchmark results not found or empty." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi |