From 98b14d03de01f1005dd8efe36dc7b5b5115bde6c Mon Sep 17 00:00:00 2001 From: turegjorup Date: Wed, 8 Jul 2026 17:15:32 +0200 Subject: [PATCH 1/2] ci: scope image pulls to the services each job needs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every job pulled and started the whole compose stack (mariadb, phpfpm, nginx, mail, rabbit, elasticsearch, …). Scope each to its real deps: - api-spec export, PHPStan, Rector → phpfpm only, as one-off `docker compose run --rm --no-deps phpfpm …` (no lingering container, matching the templated composer/php/twig workflows) - API test → phpfpm + elasticsearch via `up --wait --no-deps` (ES must be a running service the tests connect to) Pull only the needed images; --no-deps stops phpfpm's mariadb/rabbit dependencies from dragging the rest of the stack in. The api-spec job now drives docker compose directly, dropping the Task setup that ran `site:update` (= pull/up everything). Verified: the full suite passes with mariadb and rabbit stopped; tests reference no Doctrine/DB and ApiTestCase uses the in-process kernel, so nginx is not needed either. --- .github/workflows/api-spec.yml | 13 +++++++------ .github/workflows/pr.yaml | 26 ++++++++++++++------------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/api-spec.yml b/.github/workflows/api-spec.yml index 0e5bdd8..6880126 100644 --- a/.github/workflows/api-spec.yml +++ b/.github/workflows/api-spec.yml @@ -34,16 +34,17 @@ jobs: key: vendor-php8.4-${{ hashFiles('composer.lock') }} restore-keys: vendor-php8.4- - # https://taskfile.dev/installation/#github-actions - - uses: go-task/setup-task@v2 - - - run: | + - name: Install dependencies + run: | docker network create frontend - task --yes site:update + # The spec export only needs PHP — pull phpfpm alone and run it as a + # one-off (--no-deps skips mariadb/rabbit), not the whole stack. + docker compose pull --quiet phpfpm + docker compose run --rm --no-deps phpfpm composer install --no-interaction - name: Export API specification run: | - task --yes api:spec:export + docker compose run --rm --no-deps phpfpm bin/console api:openapi:export --yaml --output=public/spec.yaml --no-interaction - name: Check for changes in specification id: git-diff-spec diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e6b184a..b83d147 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,8 +23,10 @@ jobs: - name: Start docker compose setup and install site run: | docker network create frontend - docker compose pull --quiet - docker compose up --detach --wait + # API tests need PHP + Elasticsearch only (not mariadb/rabbit/nginx/mail); + # --no-deps keeps phpfpm's mariadb/rabbit dependencies from starting. + docker compose pull --quiet phpfpm elasticsearch + docker compose up --detach --wait --no-deps phpfpm elasticsearch docker compose exec -T phpfpm composer install --no-interaction - name: Load test fixtures @@ -58,16 +60,16 @@ jobs: key: vendor-php8.4-${{ hashFiles('composer.lock') }} restore-keys: vendor-php8.4- - - name: Start docker compose setup and install site + - name: Install dependencies run: | docker network create frontend - docker compose pull --quiet - docker compose up --detach --wait - docker compose exec -T phpfpm composer install --no-interaction + # PHPStan only needs PHP — pull phpfpm and run it as a one-off (--no-deps). + docker compose pull --quiet phpfpm + docker compose run --rm --no-deps phpfpm composer install --no-interaction - name: Run code analysis run: | - docker compose exec -T phpfpm vendor/bin/phpstan analyse --no-progress + docker compose run --rm --no-deps phpfpm vendor/bin/phpstan analyse --no-progress code-analysis-rector: runs-on: ubuntu-latest @@ -82,13 +84,13 @@ jobs: key: vendor-php8.4-${{ hashFiles('composer.lock') }} restore-keys: vendor-php8.4- - - name: Start docker compose setup and install site + - name: Install dependencies run: | docker network create frontend - docker compose pull --quiet - docker compose up --detach --wait - docker compose exec -T phpfpm composer install --no-interaction + # Rector only needs PHP — pull phpfpm and run it as a one-off (--no-deps). + docker compose pull --quiet phpfpm + docker compose run --rm --no-deps phpfpm composer install --no-interaction - name: Check for Rector suggestions run: | - docker compose exec -T phpfpm vendor/bin/rector process --dry-run --no-progress-bar + docker compose run --rm --no-deps phpfpm vendor/bin/rector process --dry-run --no-progress-bar From 08a712d0796ac07e71dccbe24165ac5c49c33a08 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Wed, 8 Jul 2026 17:19:15 +0200 Subject: [PATCH 2/2] docs: add CHANGELOG entry for scoped CI image pulls --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2138a30..d8c91db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ See [keep a changelog] for information about writing changes to this log. ## [Unreleased] +- [PR-56](https://github.com/itk-dev/event-database-api/pull/56) + Scope CI image pulls to each job's real dependencies (phpfpm, or phpfpm + elasticsearch) instead of the whole stack - [PR-54](https://github.com/itk-dev/event-database-api/pull/54) Add Rector (relevant sets aligned with PHPStan), apply it across the codebase, and run it in CI - [PR-53](https://github.com/itk-dev/event-database-api/pull/53)