|
| 1 | +name: HTML API benchmark A/A |
| 2 | + |
| 3 | +# Measures the noise of tests/performance/html-api/bench.php on GitHub-hosted runners. |
| 4 | +# Both trees are the same checkout, so every difference the report shows is noise. |
| 5 | +# Each matrix job runs on its own runner, so the three runs per JIT setting also |
| 6 | +# show how much results vary between runners. |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - html-api/benchmark-ci-aa |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +# Disable permissions for all available scopes by default. |
| 14 | +# Any needed permissions should be configured at the job level. |
| 15 | +permissions: {} |
| 16 | + |
| 17 | +jobs: |
| 18 | + # Runs one A/A benchmark over the synthetic documents. |
| 19 | + # |
| 20 | + # Performs the following steps: |
| 21 | + # - Checks out the repository. |
| 22 | + # - Sets up PHP. |
| 23 | + # - Logs the runner's CPU and PHP configuration. |
| 24 | + # - Runs the A/A benchmark and writes the report to the job summary. |
| 25 | + # - Uploads the full JSON result and the CPU description. |
| 26 | + aa: |
| 27 | + name: A/A, JIT ${{ matrix.jit }}, run ${{ matrix.run }} |
| 28 | + runs-on: ubuntu-24.04 |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + timeout-minutes: 30 |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + jit: [ 'on', 'off' ] |
| 36 | + run: [ 1, 2, 3 ] |
| 37 | + defaults: |
| 38 | + run: |
| 39 | + shell: bash |
| 40 | + env: |
| 41 | + JIT: ${{ matrix.jit }} |
| 42 | + RESULT: aa-jit-${{ matrix.jit }}-run-${{ matrix.run }} |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 47 | + with: |
| 48 | + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} |
| 49 | + persist-credentials: false |
| 50 | + |
| 51 | + - name: Set up PHP |
| 52 | + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 |
| 53 | + with: |
| 54 | + php-version: '8.5' |
| 55 | + coverage: none |
| 56 | + |
| 57 | + - name: Log runner information |
| 58 | + run: | |
| 59 | + mkdir -p "$RESULT" |
| 60 | + lscpu | tee "$RESULT/lscpu.txt" |
| 61 | + php --version |
| 62 | + php -i | grep -E '^opcache\.(enable|enable_cli|jit|jit_buffer_size) ' |
| 63 | + { |
| 64 | + echo '### Runner' |
| 65 | + echo '```' |
| 66 | + grep -E '^(Model name|CPU\(s\)):' "$RESULT/lscpu.txt" |
| 67 | + php --version | head -n 1 |
| 68 | + echo '```' |
| 69 | + } >> "$GITHUB_STEP_SUMMARY" |
| 70 | +
|
| 71 | + # The JIT-off run disables the JIT explicitly in case php.ini enables it. |
| 72 | + - name: Run the A/A benchmark |
| 73 | + run: | |
| 74 | + if [ 'on' = "$JIT" ]; then |
| 75 | + jit_args=( --jit ) |
| 76 | + else |
| 77 | + jit_args=( '--php-args=-d opcache.jit=disable' ) |
| 78 | + fi |
| 79 | + php tests/performance/html-api/bench.php \ |
| 80 | + --base . \ |
| 81 | + --head . \ |
| 82 | + --no-corpus \ |
| 83 | + "${jit_args[@]}" \ |
| 84 | + --format markdown \ |
| 85 | + --save "$RESULT/result.json" \ |
| 86 | + | tee -a "$GITHUB_STEP_SUMMARY" |
| 87 | +
|
| 88 | + - name: Upload the result |
| 89 | + if: ${{ ! cancelled() }} |
| 90 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 91 | + with: |
| 92 | + name: ${{ env.RESULT }} |
| 93 | + path: ${{ env.RESULT }} |
| 94 | + if-no-files-found: error |
0 commit comments