From 7ce3bc1080509ddb474e6cf1e9d100b023b18a64 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 00:51:46 +0200 Subject: [PATCH 1/7] 147 - Drop coverage from CI and run PHPUnit directly --- .forgejo/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index fada4116..90b25726 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: with: php-version: '8.3' extensions: pdo_sqlite, mbstring, xml, dom - coverage: pcov + coverage: none - name: Cache Composer dependencies uses: https://data.forgejo.org/actions/cache@v4 @@ -41,4 +41,4 @@ jobs: run: vendor/bin/phpstan analyse --memory-limit=1G - name: Tests - run: php artisan test --coverage-clover coverage.xml --coverage-text + run: php -d memory_limit=512M vendor/bin/phpunit -- 2.45.2 From 8340469e392ebd413a23bc9a428e9020feec605a Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 00:59:05 +0200 Subject: [PATCH 2/7] 147 - Run CI in a prebuilt image instead of installing PHP each run --- .forgejo/workflows/ci.yml | 9 +------ .forgejo/workflows/images.yml | 44 +++++++++++++++++++++++++++++++++++ docker/build/Dockerfile.ci | 25 ++++++++++++++++++++ 3 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 .forgejo/workflows/images.yml create mode 100644 docker/build/Dockerfile.ci diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 90b25726..7e98af9c 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -10,17 +10,10 @@ jobs: ci: runs-on: docker container: - image: catthehacker/ubuntu:act-latest + image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:latest steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Set up PHP - uses: https://github.com/shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: pdo_sqlite, mbstring, xml, dom - coverage: none - - name: Cache Composer dependencies uses: https://data.forgejo.org/actions/cache@v4 with: diff --git a/.forgejo/workflows/images.yml b/.forgejo/workflows/images.yml new file mode 100644 index 00000000..2bdd4009 --- /dev/null +++ b/.forgejo/workflows/images.yml @@ -0,0 +1,44 @@ +name: Build and Push Base Images + +on: + push: + branches: [main] + paths: + - 'docker/build/**' + - '.forgejo/workflows/images.yml' + workflow_dispatch: + +jobs: + images: + runs-on: docker + container: + image: catthehacker/ubuntu:act-latest + strategy: + matrix: + include: + - name: fedi-feed-router-base + file: docker/build/Dockerfile.base + - name: fedi-feed-router-ci + file: docker/build/Dockerfile.ci + steps: + - uses: https://data.forgejo.org/actions/checkout@v4 + + - name: Set up Docker Buildx + uses: https://data.forgejo.org/docker/setup-buildx-action@v3 + + - name: Login to Forgejo Registry + uses: https://data.forgejo.org/docker/login-action@v3 + with: + registry: forge.lvl0.xyz + username: ${{ github.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: https://data.forgejo.org/docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.file }} + push: true + tags: | + forge.lvl0.xyz/lvl0/${{ matrix.name }}:latest + forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }} diff --git a/docker/build/Dockerfile.ci b/docker/build/Dockerfile.ci new file mode 100644 index 00000000..05481602 --- /dev/null +++ b/docker/build/Dockerfile.ci @@ -0,0 +1,25 @@ +# Image for CI: PHP and Composer only, no runtime server or frontend toolchain. +# Tests run against sqlite in memory (see .env.testing), so no database client +# or cache extension is needed. +# +# Extensions here are the ext-* requirements from composer.lock that php:alpine +# does not already bundle. Regenerate that list before changing this file. +FROM php:8.3-alpine + +COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions \ + pdo_sqlite \ + mbstring \ + dom \ + xml \ + fileinfo \ + iconv \ + pcntl \ + posix + +# nodejs is not used by the app's tests; the Forgejo/GitHub JavaScript actions +# (checkout, cache) are executed with it inside this container. +RUN apk add --no-cache git unzip nodejs + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -- 2.45.2 From 7e2dd428e4bc80f3ed384afc99864ace5cf0e10f Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 01:08:34 +0200 Subject: [PATCH 3/7] 147 - Fix the Composer cache path so it caches anything --- .forgejo/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 7e98af9c..50ec54ed 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Cache Composer dependencies uses: https://data.forgejo.org/actions/cache@v4 with: - path: ~/.composer/cache + path: ~/.cache/composer key: composer-${{ hashFiles('composer.lock') }} restore-keys: composer- -- 2.45.2 From 07993ad6798dd420d32d6fa645e14356ee564918 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 01:12:24 +0200 Subject: [PATCH 4/7] 147 - Run CI on pull requests into release branches --- .forgejo/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 50ec54ed..85f3f27e 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: ['release/*'] pull_request: - branches: [main] + branches: [main, 'release/*'] jobs: ci: -- 2.45.2 From b571e1938b8628192677c9cdfc4c369b4a2457e1 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 01:22:18 +0200 Subject: [PATCH 5/7] 147 - Add gd to the CI image and declare ext-gd --- composer.json | 1 + composer.lock | 5 +++-- docker/build/Dockerfile.ci | 12 +++--------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 0254fbae..99b45229 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "license": "AGPL-3.0-only", "require": { "php": "^8.2", + "ext-gd": "*", "blade-ui-kit/blade-heroicons": "^2.6", "laravel/framework": "^12.0", "laravel/horizon": "^5.29", diff --git a/composer.lock b/composer.lock index 665abac6..fabaf870 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e6ce5effb7f8c4d5a3f6d8cd04b6e299", + "content-hash": "67923d1e9e79798f3ebe2e79954f4795", "packages": [ { "name": "blade-ui-kit/blade-heroicons", @@ -8747,7 +8747,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.2", + "ext-gd": "*" }, "platform-dev": {}, "plugin-api-version": "2.6.0" diff --git a/docker/build/Dockerfile.ci b/docker/build/Dockerfile.ci index 05481602..b63abaf4 100644 --- a/docker/build/Dockerfile.ci +++ b/docker/build/Dockerfile.ci @@ -2,21 +2,15 @@ # Tests run against sqlite in memory (see .env.testing), so no database client # or cache extension is needed. # -# Extensions here are the ext-* requirements from composer.lock that php:alpine -# does not already bundle. Regenerate that list before changing this file. +# php:alpine already bundles the rest of what composer.lock requires. gd is not +# declared anywhere but ThumbnailUploader calls it directly. FROM php:8.3-alpine COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions \ - pdo_sqlite \ - mbstring \ - dom \ - xml \ - fileinfo \ - iconv \ pcntl \ - posix + gd # nodejs is not used by the app's tests; the Forgejo/GitHub JavaScript actions # (checkout, cache) are executed with it inside this container. -- 2.45.2 From 038b60f97f8f8424a75a59bef837e3e5edfadaab Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 01:31:14 +0200 Subject: [PATCH 6/7] 147 - Pin the CI image to a version tag instead of latest --- .forgejo/workflows/ci.yml | 2 +- .forgejo/workflows/images.yml | 3 +++ docker/build/Dockerfile.ci | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 85f3f27e..a99a86a9 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: ci: runs-on: docker container: - image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:latest + image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:php8.3-1 steps: - uses: https://data.forgejo.org/actions/checkout@v4 diff --git a/.forgejo/workflows/images.yml b/.forgejo/workflows/images.yml index 2bdd4009..643e7528 100644 --- a/.forgejo/workflows/images.yml +++ b/.forgejo/workflows/images.yml @@ -18,8 +18,10 @@ jobs: include: - name: fedi-feed-router-base file: docker/build/Dockerfile.base + version: php8.3-1 - name: fedi-feed-router-ci file: docker/build/Dockerfile.ci + version: php8.3-1 steps: - uses: https://data.forgejo.org/actions/checkout@v4 @@ -40,5 +42,6 @@ jobs: file: ${{ matrix.file }} push: true tags: | + forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ matrix.version }} forge.lvl0.xyz/lvl0/${{ matrix.name }}:latest forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }} diff --git a/docker/build/Dockerfile.ci b/docker/build/Dockerfile.ci index b63abaf4..d63a4c1c 100644 --- a/docker/build/Dockerfile.ci +++ b/docker/build/Dockerfile.ci @@ -2,6 +2,10 @@ # Tests run against sqlite in memory (see .env.testing), so no database client # or cache extension is needed. # +# Published as fedi-feed-router-ci:php-, not :latest. Runners +# cache mutable tags and will not re-pull them, so bump the revision in the tag +# and in ci.yml whenever this file changes. +# # php:alpine already bundles the rest of what composer.lock requires. gd is not # declared anywhere but ThumbnailUploader calls it directly. FROM php:8.3-alpine -- 2.45.2 From aa4c3ad2b754610cc7621290204485f944831812 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sat, 15 Aug 2026 01:48:47 +0200 Subject: [PATCH 7/7] 147 - Base the CI image on Debian instead of Alpine --- .forgejo/workflows/ci.yml | 2 +- .forgejo/workflows/images.yml | 2 +- docker/build/Dockerfile.ci | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index a99a86a9..1f16d305 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: ci: runs-on: docker container: - image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:php8.3-1 + image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:php8.3-2 steps: - uses: https://data.forgejo.org/actions/checkout@v4 diff --git a/.forgejo/workflows/images.yml b/.forgejo/workflows/images.yml index 643e7528..ba694bfd 100644 --- a/.forgejo/workflows/images.yml +++ b/.forgejo/workflows/images.yml @@ -21,7 +21,7 @@ jobs: version: php8.3-1 - name: fedi-feed-router-ci file: docker/build/Dockerfile.ci - version: php8.3-1 + version: php8.3-2 steps: - uses: https://data.forgejo.org/actions/checkout@v4 diff --git a/docker/build/Dockerfile.ci b/docker/build/Dockerfile.ci index d63a4c1c..50857a02 100644 --- a/docker/build/Dockerfile.ci +++ b/docker/build/Dockerfile.ci @@ -6,18 +6,27 @@ # cache mutable tags and will not re-pull them, so bump the revision in the tag # and in ci.yml whenever this file changes. # -# php:alpine already bundles the rest of what composer.lock requires. gd is not -# declared anywhere but ThumbnailUploader calls it directly. -FROM php:8.3-alpine +# Debian-based rather than alpine: the alpine build hit repeated DNS resolution +# timeouts against codeload.github.com during composer install. +# +# gd is not declared in composer.lock but ThumbnailUploader calls it directly. +FROM php:8.3-cli COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions \ + pdo_sqlite \ + mbstring \ + dom \ + xml \ + fileinfo \ pcntl \ gd # nodejs is not used by the app's tests; the Forgejo/GitHub JavaScript actions # (checkout, cache) are executed with it inside this container. -RUN apk add --no-cache git unzip nodejs +RUN apt-get update \ + && apt-get install -y --no-install-recommends git unzip nodejs \ + && rm -rf /var/lib/apt/lists/* COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -- 2.45.2