Acknowledge Phpactor's test suite and benchmark fixtures in README #180
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo check | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo test | |
| fmt: | |
| name: Formatting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - run: cargo fmt --check | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo clippy -- -D warnings | |
| - run: cargo clippy --tests -- -D warnings | |
| php-lint: | |
| name: PHP Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| - run: php -l example.php | |
| benchmark: | |
| name: Benchmark | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Ensure gh-pages branch exists | |
| run: | | |
| if ! git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then | |
| # Create an orphan gh-pages branch without leaving the current checkout. | |
| # Build an empty tree and commit it, then push as the new branch. | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| empty_tree="$(git hash-object -t tree /dev/null)" | |
| commit="$(git commit-tree "$empty_tree" -m 'Initial gh-pages branch')" | |
| git push origin "$commit:refs/heads/gh-pages" | |
| fi | |
| - name: Run benchmarks | |
| run: cargo bench --bench completion -- --output-format bencher | tee output.txt | |
| - name: Store benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: PHPantom Benchmarks | |
| tool: cargo | |
| output-file-path: output.txt | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/bench | |
| auto-push: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| benchmark-pr: | |
| name: Benchmark (PR comparison) | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Check gh-pages branch exists | |
| id: check-gh-pages | |
| run: | | |
| if git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "⚠️ gh-pages branch does not exist yet — skipping PR benchmark comparison" | |
| fi | |
| - name: Run benchmarks | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| run: cargo bench --bench completion -- --output-format bencher | tee output.txt | |
| - name: Compare against baseline | |
| if: steps.check-gh-pages.outputs.exists == 'true' | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: PHPantom Benchmarks | |
| tool: cargo | |
| output-file-path: output.txt | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/bench | |
| auto-push: false | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| comment-on-alert: true | |
| alert-threshold: "130%" | |
| fail-on-alert: true | |
| alert-comment-cc-users: "@AJenbo" |