|
| 1 | +name: Benchmark Evidence |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + policy_profile: |
| 7 | + description: Policy profile for evaluation |
| 8 | + required: false |
| 9 | + default: ci-hosted |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - ci-hosted |
| 13 | + - ci-dedicated |
| 14 | + include_optional: |
| 15 | + description: Include JSON/YAML loader benchmarks |
| 16 | + required: false |
| 17 | + default: false |
| 18 | + type: boolean |
| 19 | + baseline_path: |
| 20 | + description: Optional baseline JSON path (repo-relative) |
| 21 | + required: false |
| 22 | + default: "" |
| 23 | + type: string |
| 24 | + schedule: |
| 25 | + - cron: "0 7 * * 1" |
| 26 | + |
| 27 | +env: |
| 28 | + VCPKG_COMMIT: "66c0373dc7fca549e5803087b9487edfe3aca0a1" |
| 29 | + |
| 30 | +jobs: |
| 31 | + windows-benchmark: |
| 32 | + name: Windows benchmark evidence |
| 33 | + runs-on: windows-2022 |
| 34 | + timeout-minutes: 45 |
| 35 | + |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Setup vcpkg |
| 41 | + uses: lukka/run-vcpkg@v11 |
| 42 | + with: |
| 43 | + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} |
| 44 | + doNotCache: false |
| 45 | + |
| 46 | + - name: Setup Python |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: "3.12" |
| 50 | + |
| 51 | + - name: Resolve benchmark options |
| 52 | + id: opts |
| 53 | + shell: pwsh |
| 54 | + run: | |
| 55 | + $profile = "ci-hosted" |
| 56 | + $includeOptional = "false" |
| 57 | + $baseline = "" |
| 58 | +
|
| 59 | + if ("${{ github.event_name }}" -eq "workflow_dispatch") { |
| 60 | + if ("${{ github.event.inputs.policy_profile }}" -ne "") { |
| 61 | + $profile = "${{ github.event.inputs.policy_profile }}" |
| 62 | + } |
| 63 | + if ("${{ github.event.inputs.include_optional }}" -eq "true") { |
| 64 | + $includeOptional = "true" |
| 65 | + } |
| 66 | + if ("${{ github.event.inputs.baseline_path }}" -ne "") { |
| 67 | + $baseline = "${{ github.event.inputs.baseline_path }}" |
| 68 | + } |
| 69 | + } |
| 70 | +
|
| 71 | + if ($baseline -eq "") { |
| 72 | + if ($profile -eq "ci-hosted") { |
| 73 | + $candidate = "benchmarks/policy/baselines/ci-hosted.windows-2022.json" |
| 74 | + if (Test-Path $candidate) { |
| 75 | + $baseline = $candidate |
| 76 | + } |
| 77 | + } |
| 78 | + elseif ($profile -eq "ci-dedicated") { |
| 79 | + $candidate = "benchmarks/policy/baselines/ci-dedicated.windows-2022.json" |
| 80 | + if (Test-Path $candidate) { |
| 81 | + $baseline = $candidate |
| 82 | + } |
| 83 | + else { |
| 84 | + throw "ci-dedicated profile requires a dedicated baseline file. Provide baseline_path input or commit $candidate." |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | +
|
| 89 | + $benchDir = "artifacts/benchmarks/${{ github.run_id }}_${{ github.run_attempt }}_ci-windows-release" |
| 90 | +
|
| 91 | + "profile=$profile" >> $env:GITHUB_OUTPUT |
| 92 | + "include_optional=$includeOptional" >> $env:GITHUB_OUTPUT |
| 93 | + "baseline=$baseline" >> $env:GITHUB_OUTPUT |
| 94 | + "bench_dir=$benchDir" >> $env:GITHUB_OUTPUT |
| 95 | +
|
| 96 | + - name: Run benchmark suite + policy evaluation |
| 97 | + shell: pwsh |
| 98 | + run: | |
| 99 | + $params = @{ |
| 100 | + Preset = "ci-windows-release" |
| 101 | + Config = "Release" |
| 102 | + OutputDir = "${{ steps.opts.outputs.bench_dir }}" |
| 103 | + PolicyProfile = "${{ steps.opts.outputs.profile }}" |
| 104 | + } |
| 105 | +
|
| 106 | + if ("${{ steps.opts.outputs.include_optional }}" -eq "true") { |
| 107 | + $params["IncludeOptional"] = $true |
| 108 | + } |
| 109 | +
|
| 110 | + if ("${{ steps.opts.outputs.baseline }}" -ne "") { |
| 111 | + $params["Baseline"] = "${{ steps.opts.outputs.baseline }}" |
| 112 | + } |
| 113 | +
|
| 114 | + .\scripts\bench.ps1 @params |
| 115 | +
|
| 116 | + - name: Upload benchmark artifacts |
| 117 | + uses: actions/upload-artifact@v4 |
| 118 | + with: |
| 119 | + name: benchmark-evidence-windows-${{ github.run_id }}-${{ github.run_attempt }} |
| 120 | + path: ${{ steps.opts.outputs.bench_dir }} |
| 121 | + if-no-files-found: error |
0 commit comments