fix(parser): reject incompatible set-hook parameter type #625
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: Bench | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| bench: | |
| name: Benchmark | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| # Shallow-clone each corpus — no git history needed, only the working | |
| # tree. Full clones of laravel/symfony/wordpress would be several GB. | |
| - name: Clone corpora (shallow) | |
| run: | | |
| git clone --depth 1 --quiet https://github.com/laravel/framework crates/php-parser/benches/corpus/laravel | |
| git clone --depth 1 --quiet https://github.com/symfony/symfony crates/php-parser/benches/corpus/symfony | |
| git clone --depth 1 --quiet https://github.com/WordPress/WordPress crates/php-parser/benches/corpus/wordpress | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: "false" # bench jobs only restore; CI workflow owns the rust cache | |
| # critcmp compares two named criterion baselines and prints a regression | |
| # table. The binary is cached by rust-cache after the first install. | |
| - name: Install critcmp | |
| run: which critcmp || cargo install critcmp --locked | |
| # ── Pull Requests ──────────────────────────────────────────────────────── | |
| # Restore the criterion baseline saved by the most recent main-branch run. | |
| # The exact key will never match (different SHA), so restore-keys provides | |
| # a prefix match that picks up the latest saved entry. | |
| - name: Restore criterion baseline | |
| id: restore-baseline | |
| if: github.event_name == 'pull_request' | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: target/criterion | |
| key: criterion-baseline-${{ runner.os }}-main-${{ github.sha }} | |
| restore-keys: criterion-baseline-${{ runner.os }}-main- | |
| # Full bench run on PRs — the whole corpus completes in ~30 s so there is | |
| # no need to use --test here. Results are saved under the "pr" baseline | |
| # so critcmp can diff them against the restored "main" baseline. | |
| - name: Benchmark (PR) | |
| if: github.event_name == 'pull_request' | |
| run: cargo bench --bench parse -- --save-baseline pr | |
| # Print a regression table. always() ensures this runs even when the bench | |
| # step above fails, so the summary always has output. | |
| - name: Compare against main baseline | |
| if: always() && github.event_name == 'pull_request' | |
| run: | | |
| { | |
| echo "### Benchmark comparison (PR vs main)" | |
| echo '```' | |
| critcmp main pr 2>&1 || \ | |
| echo "No main baseline available — push to main first to seed the cache." | |
| echo '```' | |
| } | tee -a "$GITHUB_STEP_SUMMARY" | |
| # ── Main branch ────────────────────────────────────────────────────────── | |
| # Full bench with a named baseline so future PR runs can compare against it. | |
| # The bench run is its own step so that the publish step can use if: always() | |
| # to write the summary even when cargo bench fails. | |
| - name: Benchmark (main) | |
| id: bench-main | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| run: cargo bench --bench parse -- --save-baseline main 2>&1 | tee /tmp/bench-output.txt | |
| # Write results to the job summary. always() ensures this runs even when | |
| # the bench step itself fails. | |
| - name: Publish benchmark results | |
| if: always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | |
| run: | | |
| { | |
| echo "### Benchmark results (main)" | |
| echo '```' | |
| cat /tmp/bench-output.txt 2>/dev/null || \ | |
| echo "(benchmark did not produce output)" | |
| echo '```' | |
| } | tee -a "$GITHUB_STEP_SUMMARY" | |
| # Persist the baseline for PR comparisons only when the bench succeeded. | |
| # Each push to main creates a new entry; the restore-keys prefix on the | |
| # PR restore step picks up the latest one. | |
| - name: Save criterion baseline | |
| if: steps.bench-main.outcome == 'success' | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: target/criterion | |
| key: criterion-baseline-${{ runner.os }}-main-${{ github.sha }} | |
| # Keep the full HTML report (graphs, distributions) as a downloadable | |
| # artifact for manual inspection. | |
| - name: Upload benchmark report | |
| if: steps.bench-main.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: criterion-report-${{ github.sha }} | |
| path: target/criterion | |
| retention-days: 90 |