From 9b4a723c2e476750aab7a8457b368469d9e1344d Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Wed, 19 Aug 2026 20:54:55 -0300 Subject: [PATCH 1/5] build: Pin the PHP tooling image in the Makefile. --- Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index efdfa53..868fe5e 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,20 @@ endif TTY := $(shell [ -t 0 ] && echo -it) +PHP_VERSION := $(shell sed -n 's/.*"php": *"^\([0-9]*\.[0-9]*\)".*/\1/p' composer.json) +IMAGE_VERSION := 1.0.0 +PHP_IMAGE := gustavofreze/php:${PHP_VERSION}-cli-${IMAGE_VERSION} +WORKSPACE := /var/www/html + DOCKER_RUN = docker run ${PLATFORM} --rm ${TTY} --net=host \ -e DATABASE_HOST=outbox-test-db \ -e TEST_DB_HOST_PORT=33306 \ -e DATABASE_NAME=outbox_test \ -e DATABASE_USER=outbox \ -e DATABASE_PASSWORD=outbox \ - -v ${PWD}:/app -w /app \ + -v ${PWD}:${WORKSPACE} \ -v /var/run/docker.sock:/var/run/docker.sock \ - gustavofreze/php:8.5-alpine + ${PHP_IMAGE} RESET := \033[0m GREEN := \033[0;32m @@ -52,6 +57,10 @@ show-reports: ## Open coverage and mutation reports in the browser show-outdated: ## Show outdated direct dependencies @${DOCKER_RUN} composer outdated --direct +.PHONY: show-image +show-image: ## Show the pinned PHP tooling image + @echo ${PHP_IMAGE} + .PHONY: clean clean: ## Remove dependencies and generated artifacts @sudo chown -R ${USER}:${USER} ${PWD} @@ -74,7 +83,7 @@ help: ## Display this help message | awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}' @echo "" @echo "$$(printf '$(GREEN)')Reports$$(printf '$(RESET)')" - @grep -E '^(show-reports|show-outdated):.*?## .*$$' $(MAKEFILE_LIST) \ + @grep -E '^(show-reports|show-outdated|show-image):.*?## .*$$' $(MAKEFILE_LIST) \ | awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}' @echo "" @echo "$$(printf '$(GREEN)')Cleanup$$(printf '$(RESET)')" From cc181fc98ea6aaacc15a50fc137468bc6bdac454 Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Wed, 19 Aug 2026 20:54:55 -0300 Subject: [PATCH 2/5] ci: Resolve the tooling image from the Makefile. --- .github/workflows/ci.yml | 49 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f83de..b530fb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,42 +11,39 @@ permissions: contents: read jobs: - resolve-php-version: - name: Resolve PHP version + resolve-tooling-image: + name: Resolve tooling image runs-on: ubuntu-latest timeout-minutes: 5 outputs: - php-version: ${{ steps.config.outputs.php-version }} + php-image: ${{ steps.config.outputs.php-image }} steps: - name: Checkout uses: actions/checkout@v7 - - name: Resolve PHP version from composer.json + - name: Resolve tooling image from the Makefile id: config - run: | - version=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | head -1) - echo "php-version=$version" >> "$GITHUB_OUTPUT" + run: echo "php-image=$(make show-image)" >> "$GITHUB_OUTPUT" build: name: Build - needs: resolve-php-version + needs: resolve-tooling-image runs-on: ubuntu-latest timeout-minutes: 15 + env: + image: ${{ needs.resolve-tooling-image.outputs.php-image }} + workspace: /var/www/html steps: - name: Checkout uses: actions/checkout@v7 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - tools: composer:2 - php-version: ${{ needs.resolve-php-version.outputs.php-version }} - - name: Validate composer.json - run: composer validate --no-interaction + run: docker run --rm -v "${PWD}":${{ env.workspace }} ${{ env.image }} composer validate --no-interaction - name: Install dependencies - run: composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction + run: > + docker run --rm -v "${PWD}":${{ env.workspace }} ${{ env.image }} + composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction - name: Upload vendor and composer.lock as artifact uses: actions/upload-artifact@v7 @@ -58,19 +55,13 @@ jobs: auto-review: name: Auto review - needs: [resolve-php-version, build] + needs: [resolve-tooling-image, build] runs-on: ubuntu-latest timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v7 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - tools: composer:2 - php-version: ${{ needs.resolve-php-version.outputs.php-version }} - - name: Download vendor artifact from build uses: actions/download-artifact@v8 with: @@ -78,11 +69,11 @@ jobs: path: . - name: Run review - run: composer review + run: make review tests: name: Tests - needs: [resolve-php-version, auto-review] + needs: [resolve-tooling-image, auto-review] runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -95,12 +86,6 @@ jobs: - name: Checkout uses: actions/checkout@v7 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - tools: composer:2 - php-version: ${{ needs.resolve-php-version.outputs.php-version }} - - name: Download vendor artifact from build uses: actions/download-artifact@v8 with: @@ -108,4 +93,4 @@ jobs: path: . - name: Run tests - run: composer tests + run: make tests From 166f1e074b4b70d05f7727b42566d33e8ef9091d Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Wed, 19 Aug 2026 20:54:55 -0300 Subject: [PATCH 3/5] chore: Align the tooling configuration with the ecosystem assets. --- composer.json | 1 + phpstan.neon.dist | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index e83e62a..16c4de8 100644 --- a/composer.json +++ b/composer.json @@ -64,6 +64,7 @@ "ergebnis/composer-normalize": true, "infection/extension-installer": true }, + "process-timeout": 0, "sort-packages": true }, "scripts": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index dbcd617..ae81d0b 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -3,40 +3,32 @@ parameters: paths: - src - tests + tmpDir: reports/phpstan ignoreErrors: # OutboxInsert::$parameters is an untyped iterable on an Internal collaborator; Doctrine expects array. - identifier: argument.type path: src/Internal/OutboxWriter.php - # aggregateId is intentionally typed mixed at the public exception boundary; sprintf at level max flags the mixed argument. - identifier: argument.type path: src/Exceptions/DuplicateAggregateVersion.php - # Internal collaborators handle mixed identity values per design; PHPDoc is prohibited under src/Internal/. - identifier: cast.string path: src/Internal/BinaryIdentityColumn.php - - identifier: cast.string path: src/Internal/StringIdentityColumn.php - # OutboxInsert::$parameters is a constructor parameter inside src/Internal/; PHPDoc is prohibited. - identifier: missingType.iterableValue path: src/Internal/OutboxInsert.php - # Test files are excluded from typed-array PHPDoc requirements. - identifier: missingType.iterableValue path: tests - # Doctrine fetchAssociative returns array|false at level max; tests assert on documented happy paths. - identifier: offsetAccess.nonOffsetAccessible path: tests - - identifier: argument.type path: tests - - identifier: cast.int path: tests - - identifier: property.onlyWritten path: tests reportUnmatchedIgnoredErrors: true From 36d0094e6fbd806f1a00c4d66e6fce5dfd53fca1 Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Wed, 19 Aug 2026 20:54:55 -0300 Subject: [PATCH 4/5] docs: Standardize the Copilot instructions. --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index de1576d..e34c801 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -6,7 +6,7 @@ PHP library in the tiny-blocks ecosystem. ## Mandatory pre-task step -Before starting any task, read and strictly follow `CLAUDE.md` and every rule file in +Before starting any task, read and strictly follow `.claude/CLAUDE.md` and every rule file in `.claude/rules/`. These files are the absolute source of truth for code generation. Apply every rule strictly. Do not deviate from the patterns, folder structure, or naming conventions defined in them. From 15d3ad5ba3de5f5a93fbc52bfb2a8ed925b1a982 Mon Sep 17 00:00:00 2001 From: Gustavo Freze Date: Wed, 19 Aug 2026 20:54:55 -0300 Subject: [PATCH 5/5] docs: Run the pull request checklist through the Makefile. --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7a2c836..e9cc769 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,5 +12,5 @@ Closes #... - [ ] Tests added or updated. - [ ] Documentation updated when applicable. -- [ ] `composer review` passes. -- [ ] `composer tests` passes. +- [ ] `make review` passes. +- [ ] `make tests` passes.