-
Notifications
You must be signed in to change notification settings - Fork 35
Chore: Consolidate CI workflows and harden test infra #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
04a750f
Chore: Consolidate CI workflows and harden test infra
loks0n 5e3a863
Chore: Rename CI jobs and split tests into unit/e2e
loks0n 49a085d
Ignore ext-opentelemetry platform req for host PHP jobs
loks0n c17cb6a
Pin composer platform to PHP 8.2 so lock stays 8.2-compatible
loks0n c6b9eb2
Group checks under Checks/ prefix and use matrix for E2E adapters
loks0n c0f88b2
Rename composer lint script to format:check and align CI job
loks0n 4afa42d
Rename composer check to analyze; remove misnamed CodeQL workflow
loks0n 95b6ec5
Replace phpbench with k6 benchmark; post results as PR comment
loks0n 9eb59c0
Bump k6 load to 60s, shorten PR comment, use grafana/run-k6-action
loks0n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [master, "*.x"] | ||
|
|
||
| jobs: | ||
| format: | ||
| name: Checks / Format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Pint | ||
| run: | | ||
| docker run --rm -v "$PWD":/app -w /app composer:2.7 sh -c \ | ||
| "composer install --profile --ignore-platform-reqs --no-interaction && composer format:check" | ||
|
|
||
| analyze: | ||
| name: Checks / Analyze | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.2' | ||
| extensions: swoole | ||
| coverage: none | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Validate composer.json and composer.lock | ||
| run: composer validate --strict | ||
|
|
||
| - name: Get composer cache directory | ||
| id: composer-cache | ||
| run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ steps.composer-cache.outputs.dir }} | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
| restore-keys: composer- | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=ext-opentelemetry | ||
|
|
||
| - name: PHPStan | ||
| run: composer analyze | ||
|
|
||
| unit: | ||
| name: Tests / Unit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.2' | ||
| extensions: swoole | ||
| coverage: none | ||
|
|
||
| - name: Get composer cache directory | ||
| id: composer-cache | ||
| run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ steps.composer-cache.outputs.dir }} | ||
| key: composer-${{ hashFiles('composer.lock') }} | ||
| restore-keys: composer- | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=ext-opentelemetry | ||
|
|
||
| - name: Run unit tests | ||
| run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit | ||
|
|
||
| e2e: | ||
| name: Tests / E2E / ${{ matrix.adapter.display }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| adapter: | ||
| - { id: fpm, display: FPM } | ||
| - { id: swoole, display: Swoole } | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build and wait for ${{ matrix.adapter.id }} to be healthy | ||
| run: docker compose up -d --build --wait ${{ matrix.adapter.id }} | ||
|
|
||
| - name: Run E2E tests | ||
| run: docker compose exec -T ${{ matrix.adapter.id }} vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-${{ matrix.adapter.id }} | ||
|
|
||
| - name: Dump container logs on failure | ||
| if: failure() | ||
| run: docker compose logs ${{ matrix.adapter.id }} | ||
|
|
||
| benchmark: | ||
| name: Benchmark | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build and wait for swoole to be healthy | ||
| run: docker compose up -d --build --wait swoole | ||
|
|
||
| - name: Install k6 | ||
| uses: grafana/setup-k6-action@v1 | ||
|
|
||
| - name: Run k6 benchmark | ||
| run: | | ||
| set -o pipefail | ||
| k6 run --summary-export=summary.json tests/bench/benchmark.js 2>&1 | tee summary.txt | ||
| env: | ||
| BASE_URL: http://localhost:9501 | ||
|
|
||
| - name: Render PR comment body | ||
| if: always() | ||
| run: | | ||
| { | ||
| echo '### k6 benchmark' | ||
| echo | ||
| echo '```' | ||
| cat summary.txt | ||
| echo '```' | ||
| } > summary.md | ||
|
|
||
| - name: Upload raw k6 summary | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: k6-summary | ||
| path: | | ||
| summary.json | ||
| summary.txt | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Comment benchmark summary on PR | ||
| if: github.event_name == 'pull_request' && always() | ||
| uses: marocchino/sticky-pull-request-comment@v2 | ||
| with: | ||
| header: k6-benchmark | ||
| path: summary.md | ||
|
|
||
| - name: Dump swoole logs on failure | ||
| if: failure() | ||
| run: docker compose logs swoole | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| /vendor/ | ||
| /.idea/ | ||
| *.cache | ||
| /.vscode/ | ||
| /composer.phar | ||
| .phpunit.result.cache | ||
| /.phpunit.cache/ | ||
| *.cache |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codeql-analysis.ymlwas deleted as part of this PR but is not mentioned in the description. The repository no longer has any automated security scanning for PHP source code. If this is intentional, the PR description should document the decision; if not, the file should be restored or replaced with an equivalent scanning step inci.yml.