Compare commits

..

No commits in common. "testing/169-mariadb-test-suite" and "main" have entirely different histories.

13 changed files with 22 additions and 45 deletions

View file

@ -11,13 +11,8 @@ BCRYPT_ROUNDS=4
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_STACK=single LOG_STACK=single
# Host and credentials must match docker/dev/docker-compose.yml; nothing enforces it. DB_CONNECTION=sqlite
DB_CONNECTION=mysql DB_DATABASE=:memory:
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ffr_testing
DB_USERNAME=ffr
DB_PASSWORD=ffr
SESSION_DRIVER=array SESSION_DRIVER=array

View file

@ -1,6 +1,7 @@
name: Build and Push Docker Image name: Build and Push Docker Image
on: on:
push: push:
branches: [main]
tags: ['v*'] tags: ['v*']
jobs: jobs:

View file

@ -10,20 +10,7 @@ jobs:
ci: ci:
runs-on: docker runs-on: docker
container: container:
image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:php8.3-4 image: forge.lvl0.xyz/lvl0/fedi-feed-router-ci:php8.3-3
services:
db:
image: mariadb:11
env:
MARIADB_DATABASE: ffr_testing
MARIADB_USER: ffr
MARIADB_PASSWORD: ffr
MARIADB_ROOT_PASSWORD: ffr_root_ci
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps: steps:
- uses: https://data.forgejo.org/actions/checkout@v4 - uses: https://data.forgejo.org/actions/checkout@v4

View file

@ -18,10 +18,10 @@ jobs:
include: include:
- name: fedi-feed-router-base - name: fedi-feed-router-base
file: docker/build/Dockerfile.base file: docker/build/Dockerfile.base
version: php8.3-2 version: php8.3-1
- name: fedi-feed-router-ci - name: fedi-feed-router-ci
file: docker/build/Dockerfile.ci file: docker/build/Dockerfile.ci
version: php8.3-4 version: php8.3-3
steps: steps:
- uses: https://data.forgejo.org/actions/checkout@v4 - uses: https://data.forgejo.org/actions/checkout@v4
@ -43,4 +43,5 @@ jobs:
push: true push: true
tags: | tags: |
forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ matrix.version }} forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ matrix.version }}
forge.lvl0.xyz/lvl0/${{ matrix.name }}:latest
forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }} forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }}

View file

@ -1,5 +1,5 @@
# Production Dockerfile - uses pre-built base image # Production Dockerfile - uses pre-built base image
FROM forge.lvl0.xyz/lvl0/fedi-feed-router-base:php8.3-2 FROM forge.lvl0.xyz/lvl0/fedi-feed-router-base:latest
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app

View file

@ -1,5 +1,5 @@
# Base image with FrankenPHP, PHP extensions, Node, and Composer # Base image with FrankenPHP, PHP extensions, Node, and Composer
FROM dunglas/frankenphp:1.12.7-php8.3.35-alpine FROM dunglas/frankenphp:latest-php8.3-alpine
# Install system dependencies # Install system dependencies
RUN apk add --no-cache \ RUN apk add --no-cache \

View file

@ -1,7 +1,6 @@
# Image for CI: PHP and Composer only, no runtime server or frontend toolchain. # Image for CI: PHP and Composer only, no runtime server or frontend toolchain.
# pdo_mysql is here for the MariaDB test database (#169); pdo_sqlite stays until # Tests run against sqlite in memory (see .env.testing), so no database client
# that switch lands. No CLI database client — PHPUnit reaches the database # or cache extension is needed.
# through PDO and never shells out.
# #
# Published as fedi-feed-router-ci:php<version>-<revision>, not :latest. Runners # Published as fedi-feed-router-ci:php<version>-<revision>, not :latest. Runners
# cache mutable tags and will not re-pull them, so bump the revision in the tag # cache mutable tags and will not re-pull them, so bump the revision in the tag
@ -17,7 +16,6 @@ COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /u
RUN install-php-extensions \ RUN install-php-extensions \
pdo_sqlite \ pdo_sqlite \
pdo_mysql \
mbstring \ mbstring \
dom \ dom \
xml \ xml \

View file

@ -56,7 +56,6 @@ services:
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:-ffr_root_dev}" MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:-ffr_root_dev}"
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql
- ./initdb:/docker-entrypoint-initdb.d:ro
healthcheck: healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s interval: 10s

View file

@ -1,7 +0,0 @@
-- Runs only on an empty data directory. Recreate the volume to apply changes.
CREATE DATABASE IF NOT EXISTS ffr_testing
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON ffr_testing.* TO 'ffr'@'%';
FLUSH PRIVILEGES;

View file

@ -23,8 +23,8 @@
<server name="APP_MAINTENANCE_DRIVER" value="file" force="true"/> <server name="APP_MAINTENANCE_DRIVER" value="file" force="true"/>
<server name="BCRYPT_ROUNDS" value="4" force="true"/> <server name="BCRYPT_ROUNDS" value="4" force="true"/>
<server name="CACHE_STORE" value="array" force="true"/> <server name="CACHE_STORE" value="array" force="true"/>
<server name="DB_CONNECTION" value="mysql" force="true"/> <server name="DB_CONNECTION" value="sqlite" force="true"/>
<server name="DB_DATABASE" value="ffr_testing" force="true"/> <server name="DB_DATABASE" value=":memory:" force="true"/>
<server name="MAIL_MAILER" value="array" force="true"/> <server name="MAIL_MAILER" value="array" force="true"/>
<server name="PULSE_ENABLED" value="false" force="true"/> <server name="PULSE_ENABLED" value="false" force="true"/>
<server name="QUEUE_CONNECTION" value="sync" force="true"/> <server name="QUEUE_CONNECTION" value="sync" force="true"/>

View file

@ -62,7 +62,7 @@ public function test_maps_rows_to_the_local_channel_by_name(): void
{ {
$this->restoreLegacyTable(); $this->restoreLegacyTable();
$channel = PlatformChannel::factory()->create(['name' => 'newsbottest']); $channel = PlatformChannel::factory()->create(['name' => 'newsbottest', 'channel_id' => 'newsbottest']);
$this->seedLegacyRow('217', 'newsbottest', '1'); $this->seedLegacyRow('217', 'newsbottest', '1');
$this->seedLegacyRow('217', 'newsbottest', '2'); $this->seedLegacyRow('217', 'newsbottest', '2');
@ -76,7 +76,7 @@ public function test_drops_rows_that_match_no_channel(): void
{ {
$this->restoreLegacyTable(); $this->restoreLegacyTable();
PlatformChannel::factory()->create(['name' => 'newsbottest']); PlatformChannel::factory()->create(['name' => 'newsbottest', 'channel_id' => 'newsbottest']);
$this->seedLegacyRow('999', 'a-community-that-no-longer-exists', '1'); $this->seedLegacyRow('999', 'a-community-that-no-longer-exists', '1');
$this->runMigration(); $this->runMigration();
@ -94,10 +94,12 @@ public function test_drops_rows_whose_channel_name_is_ambiguous_across_instances
PlatformChannel::factory()->create([ PlatformChannel::factory()->create([
'platform_instance_id' => $first->id, 'platform_instance_id' => $first->id,
'name' => 'news', 'name' => 'news',
'channel_id' => 'news',
]); ]);
PlatformChannel::factory()->create([ PlatformChannel::factory()->create([
'platform_instance_id' => $second->id, 'platform_instance_id' => $second->id,
'name' => 'news', 'name' => 'news',
'channel_id' => 'news-two',
]); ]);
$this->seedLegacyRow('8', 'news', '1'); $this->seedLegacyRow('8', 'news', '1');
@ -111,7 +113,7 @@ public function test_leaves_a_schema_the_new_code_can_use(): void
{ {
$this->restoreLegacyTable(); $this->restoreLegacyTable();
$channel = PlatformChannel::factory()->create(['name' => 'newsbottest']); $channel = PlatformChannel::factory()->create(['name' => 'newsbottest', 'channel_id' => 'newsbottest']);
$this->seedLegacyRow('217', 'newsbottest', '1'); $this->seedLegacyRow('217', 'newsbottest', '1');
$this->runMigration(); $this->runMigration();

View file

@ -41,6 +41,7 @@ protected function setUp(): void
$instance = PlatformInstance::factory()->create(['url' => 'https://lemmy.test']); $instance = PlatformInstance::factory()->create(['url' => 'https://lemmy.test']);
$channel = PlatformChannel::factory()->create([ $channel = PlatformChannel::factory()->create([
'platform_instance_id' => $instance->id, 'platform_instance_id' => $instance->id,
'channel_id' => 'news',
'name' => 'news', 'name' => 'news',
]); ]);
$account = PlatformAccount::factory()->create(['instance_url' => 'https://lemmy.test']); $account = PlatformAccount::factory()->create(['instance_url' => 'https://lemmy.test']);
@ -179,6 +180,7 @@ public function test_a_second_instance_with_the_same_community_name_does_not_col
$otherInstance = PlatformInstance::factory()->create(['url' => 'https://other.test']); $otherInstance = PlatformInstance::factory()->create(['url' => 'https://other.test']);
$otherChannel = PlatformChannel::factory()->create([ $otherChannel = PlatformChannel::factory()->create([
'platform_instance_id' => $otherInstance->id, 'platform_instance_id' => $otherInstance->id,
'channel_id' => 'news',
'name' => 'news', 'name' => 'news',
]); ]);

View file

@ -89,8 +89,7 @@ public function test_listener_skips_already_validated_articles(): void
public function test_listener_skips_articles_with_existing_publication(): void public function test_listener_skips_articles_with_existing_publication(): void
{ {
$feed = Feed::factory()->create(); $feed = Feed::factory()->create();
/** @var Route $route */ Route::factory()->active()->create(['feed_id' => $feed->id]);
$route = Route::factory()->active()->create(['feed_id' => $feed->id]);
$article = Article::factory()->create([ $article = Article::factory()->create([
'feed_id' => $feed->id, 'feed_id' => $feed->id,
@ -99,7 +98,7 @@ public function test_listener_skips_articles_with_existing_publication(): void
ArticlePublication::create([ ArticlePublication::create([
'article_id' => $article->id, 'article_id' => $article->id,
'post_id' => 'test-post-id', 'post_id' => 'test-post-id',
'platform_channel_id' => $route->platform_channel_id, 'platform_channel_id' => 1,
'published_at' => now(), 'published_at' => now(),
'published_by' => 'test-user', 'published_by' => 'test-user',
]); ]);