Skip to content

Update dependency phpstan/phpstan to v2 #2258

Update dependency phpstan/phpstan to v2

Update dependency phpstan/phpstan to v2 #2258

Workflow file for this run

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Benchmark"
on:
pull_request:
jobs:
phpbench:
name: "Benchmark"
runs-on: ${{ matrix.operating-system }}
services:
postgres:
# Docker Hub image
image: "postgres:17.1"
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: eventstore
options: >-
--health-cmd "pg_isready"
ports:
- "5432:5432"
strategy:
matrix:
dependencies:
- "locked"
php-version:
- "8.3"
operating-system:
- "ubuntu-latest"
env:
DB_URL: 'pdo-pgsql://postgres:postgres@localhost:5432/eventstore?charset=utf8'
steps:
- name: "Install PHP"
uses: "shivammathur/[email protected]"
with:
coverage: none
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
extensions: pdo_sqlite
- name: "Checkout base"
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: ramsey/[email protected]
with:
dependency-versions: ${{ matrix.dependencies }}
- name: "phpbench on base"
run: "vendor/bin/phpbench run tests/Benchmark --progress=none --report=default --tag=base"
- name: "Checkout"
uses: actions/checkout@v4
with:
clean: false
- uses: ramsey/[email protected]
with:
dependency-versions: ${{ matrix.dependencies }}
- name: "phpbench diff"
id: bench
run: 'vendor/bin/phpbench run tests/Benchmark --progress=none --report=diff --ref=base > bench.txt'
- name: "Get Bench Result"
if: ${{ success() || (failure() && steps.bench.conclusion == 'failure') }}
id: phpbench
run: |
echo 'BENCH_RESULT<<EOF' >> $GITHUB_ENV
cat bench.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: actions/github-script@v7
if: ${{ success() || (failure() && steps.bench.conclusion == 'failure') }}
with:
script: |
// Get the existing comments.
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
})
// Find any comment already made by the bot.
const botComment = comments.find(comment => comment.user.id === 41898282)
const commentBody = `
Hello :wave:
<details>
<summary>here is the most recent benchmark result:</summary>
<p>
\`\`\`
${{ env.BENCH_RESULT }}
\`\`\`
</p>
</details>
This comment gets update everytime a new commit comes in!
`;
if (context.payload.pull_request.head.repo.full_name !== 'patchlevel/event-sourcing') {
console.log('Not attempting to write comment on PR from fork');
} else {
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
})
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
body: commentBody
})
}
}