Bump github/codeql-action/analyze from 4.36.2 to 4.37.1 #4434
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
| # Copyright (c) Microsoft Corporation. All rights reserved. | |
| # Licensed under the Apache 2.0 License. | |
| name: "Benchmark A/B Testing" | |
| on: | |
| pull_request: | |
| types: | |
| - labeled | |
| - synchronize | |
| - opened | |
| - reopened | |
| permissions: read-all | |
| jobs: | |
| benchmark_pr: | |
| name: Benchmark PR | |
| runs-on: | |
| [ | |
| self-hosted, | |
| 1ES.Pool=gha-vmss-d16av6-ci, | |
| "JobId=bab_benchmark_pr-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}", | |
| ] | |
| if: ${{ (github.event.action == 'labeled' && github.event.label.name == 'bench-ab') || (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'bench-ab')) }} | |
| container: | |
| image: mcr.microsoft.com/azurelinux/base/core:3.0 | |
| options: --user root | |
| steps: | |
| - name: Setup container dependencies | |
| run: | | |
| gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY | |
| tdnf -y update && tdnf -y install ca-certificates git gh | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: ./scripts/setup-ci.sh | |
| - name: Confirm platform | |
| run: python3 tests/infra/platform_detection.py virtual | |
| - name: Build and run benchmarks | |
| run: | | |
| git config --global --add safe.directory /__w/CCF/CCF | |
| mkdir build | |
| cd build | |
| cmake -GNinja -DWORKER_THREADS=2 .. | |
| ninja | |
| # Microbenchmarks | |
| ./tests.sh -VV -L benchmark | |
| # End to end performance tests | |
| ./tests.sh -VV -L perf -C perf | |
| # Convert microbenchmark output to bencher json | |
| source env/bin/activate | |
| PYTHONPATH=../tests python convert_pico_to_bencher.py | |
| - name: Restore recent main perf results | |
| run: | | |
| set -exo pipefail | |
| name="perf-bench-virtual-main" | |
| mkdir -p main_perf | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| run_ids=$(gh api "repos/${{ github.repository }}/actions/artifacts?name=${name}&per_page=100" \ | |
| --jq '[.artifacts[] | select(.expired == false)] | sort_by(.created_at) | reverse | .[0:20] | .[].workflow_run.id') | |
| for run_id in $run_ids; do | |
| if gh run download "$run_id" --name "$name" --dir main_artifact; then | |
| find main_artifact -name '*.json' -exec cp {} main_perf/ \; | |
| break | |
| fi | |
| done | |
| # Select the comparison window here; perf_compare_radar.py uses every | |
| # retained point. | |
| (cd main_perf && ls -1 | sort -t- -k1,1n -k2,2n -k3,3n | head -n -30 | xargs -r rm -f) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Summarise A/B comparison against main | |
| run: | | |
| set -exo pipefail | |
| python3 scripts/perf_compare_radar.py main_perf build/bencher.json \ | |
| --branch-label "#${{ github.event.pull_request.number }}" \ | |
| | tee benchmark-ab-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload A/B comparison summary | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: benchmark-ab-summary | |
| path: benchmark-ab-summary.md | |
| if-no-files-found: error | |
| retention-days: 1 | |
| post_summary: | |
| name: Post performance summary | |
| needs: benchmark_pr | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Download A/B comparison summary | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: benchmark-ab-summary | |
| - name: Create or update PR comment | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| marker="<!-- benchmark-ab-summary -->" | |
| { | |
| printf '%s\n\n' "$marker" | |
| cat benchmark-ab-summary.md | |
| } > benchmark-ab-comment.md | |
| comment_ids=$(gh api --paginate \ | |
| "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ | |
| --jq ".[] | select(.user.login == \"github-actions[bot]\" and (.body | contains(\"${marker}\"))) | .id") | |
| comment_id=${comment_ids%%$'\n'*} | |
| if [[ -n "$comment_id" ]]; then | |
| gh api --method PATCH \ | |
| "repos/${GITHUB_REPOSITORY}/issues/comments/${comment_id}" \ | |
| -F body=@benchmark-ab-comment.md > /dev/null | |
| else | |
| gh api --method POST \ | |
| "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ | |
| -F body=@benchmark-ab-comment.md > /dev/null | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} |