From 20b7ddf087983a44e86e31df2e8c620212f299eb Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Fri, 24 Apr 2026 15:28:53 +0200 Subject: [PATCH 1/2] Use core matrix --- .github/workflows/ci-linux.yml | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 87e6ec6..aa65612 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -16,21 +16,43 @@ concurrency: cancel-in-progress: true jobs: + setup-phpunit-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.gen.outputs.matrix }} + steps: + - uses: actions/checkout@v6 + - id: gen + uses: galette/.github/actions/matrix-generator@main + with: + all-jobs: ${{ github.event_name != 'pull_request' && github.repository == 'galette/galette-activities' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')) }} + + setup-lint-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.gen.outputs.matrix }} + steps: + - uses: actions/checkout@v6 + - id: gen + uses: galette/.github/actions/matrix-generator@main + with: + target: lint + all-jobs: ${{ github.event_name != 'pull_request' && github.repository == 'galette/galette-activities' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')) }} + lint: runs-on: ubuntu-latest - name: "Lint on PHP ${{ matrix.php-versions }}" + needs: setup-lint-matrix + name: "Lint on PHP ${{ matrix.php-version }}" strategy: - matrix: - php-versions: [ '8.3', '8.5' ] - coverage: [none] + matrix: ${{ fromJSON(needs.setup-lint-matrix.outputs.matrix) }} fail-fast: false steps: - name: PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} + php-version: ${{ matrix.php-version }} tools: composer coverage: ${{ matrix.coverage }} @@ -70,7 +92,7 @@ jobs: ../../vendor/bin/phpcs lib/ ./*.php - name: CS Fixer - if: matrix.php-versions == '8.3' + if: matrix.php-is-min run: | cd galette-core/galette/plugins/plugin-activities ../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff @@ -92,32 +114,13 @@ jobs: unit-tests: runs-on: ubuntu-latest + needs: setup-phpunit-matrix strategy: - matrix: - include: - #always tests higher stable php version with lower db version - #enable coverage on higher stable php version with higher PostgreSQL version - #cache must be disabled on one always enabled build (not coverage one, this already takes much time than others) - #higher stable php version - - { php-version: "8.5", db-image: "postgres:13", coverage: none, cache: true, always: true } - - { php-version: "8.5", db-image: "postgres:17", coverage: none, cache: true, always: true } - - { php-version: "8.5", db-image: "mysql:8.0", coverage: none, cache: true, always: true } - - { php-version: "8.5", db-image: "mysql:9.1", coverage: none, cache: true, always: false } - - { php-version: "8.5", db-image: "mariadb:10.5", coverage: none, cache: false, always: true } - - { php-version: "8.5", db-image: "mariadb:11.6", coverage: none, cache: true, always: false } - #always one test with lower php version - #lower php version - - { php-version: "8.3", db-image: "postgres:13", coverage: none, cache: true, always: false } - - { php-version: "8.3", db-image: "postgres:17", coverage: none, cache: true, always: true } - - { php-version: "8.3", db-image: "mysql:8.0", coverage: none, cache: true, always: false } - - { php-version: "8.3", db-image: "mysql:9.1", coverage: none, cache: true, always: false } - - { php-version: "8.3", db-image: "mariadb:10.5", coverage: none, cache: true, always: false } - - { php-version: "8.3", db-image: "mariadb:11.6", coverage: none, cache: true, always: false } + matrix: ${{ fromJSON(needs.setup-phpunit-matrix.outputs.matrix) }} fail-fast: false env: - skip: ${{ matrix.always == false && (github.event_name == 'pull_request' || github.repository != 'galette/plugin-activities' || !(github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags'))) }} DB: ${{ matrix.db-image }} services: @@ -149,17 +152,15 @@ jobs: steps: - name: PHP - if: env.skip != 'true' uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} + php-version: ${{ matrix.php-version }} tools: composer, pecl coverage: ${{ matrix.coverage }} extensions: apcu ini-values: apc.enable_cli=1 - name: "Show versions" - if: env.skip != 'true' run: | php --version composer --version @@ -168,7 +169,6 @@ jobs: docker exec ${{ job.services.db.id }} bash -c "if [[ -n \$(command -v psql) ]]; then psql --version; else if [[ -n \$(command -v mysql) ]]; then mysql --version; else mariadb --version; fi fi" - name: Build Galette - if: env.skip != 'true' uses: galette/.github/actions/build-galette@main with: php-version: ${{ matrix.php-version }} @@ -186,7 +186,7 @@ jobs: cd galette-core bin/console galette:install -v --dbtype=pgsql --dbhost=localhost --dbname=galette_tests --dbuser=galette_tests --dbpass=g@l3tte --admin=admin --password=admin --no-interaction -w bin/console galette:plugins:install-db --all - if: env.skip != 'true' && startsWith(matrix.db-image, 'postgres') + if: startsWith(matrix.db-image, 'postgres') - name: Init for MariaDB run: | @@ -194,7 +194,7 @@ jobs: mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306 bin/console galette:install -v --dbtype=mysql --dbhost=127.0.0.1 --dbname=galette_tests --dbuser=galette_tests --dbpass=g@l3tte --admin=admin --password=admin --no-interaction -w bin/console galette:plugins:install-db --all - if: env.skip != 'true' && (startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb')) + if: startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb') - name: Unit tests if: env.skip != 'true' From 6a9599a1625d63f9531048525851ec7918a3cfdf Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Fri, 24 Apr 2026 15:30:28 +0200 Subject: [PATCH 2/2] php-cs-fixer --- .../Controllers/Crud/ActivitiesController.php | 4 ++-- .../Controllers/Crud/SubscriptionsController.php | 8 ++++---- lib/GaletteActivities/PluginGaletteActivities.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/GaletteActivities/Controllers/Crud/ActivitiesController.php b/lib/GaletteActivities/Controllers/Crud/ActivitiesController.php index 1f58dd0..f3d87b4 100644 --- a/lib/GaletteActivities/Controllers/Crud/ActivitiesController.php +++ b/lib/GaletteActivities/Controllers/Crud/ActivitiesController.php @@ -199,8 +199,8 @@ public function edit(Request $request, Response $response, ?int $id = null, stri /** * Edit action * - * @param null|int $id Model id for edit - * @param string $action Either add or edit + * @param null|int $id Model id for edit + * @param string $action Either add or edit */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { diff --git a/lib/GaletteActivities/Controllers/Crud/SubscriptionsController.php b/lib/GaletteActivities/Controllers/Crud/SubscriptionsController.php index 54216be..cf774f0 100644 --- a/lib/GaletteActivities/Controllers/Crud/SubscriptionsController.php +++ b/lib/GaletteActivities/Controllers/Crud/SubscriptionsController.php @@ -75,8 +75,8 @@ public function doAdd(Request $request, Response $response): Response /** * List page * - * @param string|null $option One of 'page' or 'order' - * @param string|int|null $value Value of the option + * @param string|null $option One of 'page' or 'order' + * @param string|int|null $value Value of the option */ public function list(Request $request, Response $response, ?string $option = null, string|int|null $value = null): Response { @@ -297,8 +297,8 @@ public function edit(Request $request, Response $response, ?int $id = null, stri /** * Edit action * - * @param null|int $id Model id for edit - * @param string $action Either add or edit + * @param null|int $id Model id for edit + * @param string $action Either add or edit */ public function doEdit(Request $request, Response $response, ?int $id = null, string $action = 'edit'): Response { diff --git a/lib/GaletteActivities/PluginGaletteActivities.php b/lib/GaletteActivities/PluginGaletteActivities.php index 845448b..7060931 100644 --- a/lib/GaletteActivities/PluginGaletteActivities.php +++ b/lib/GaletteActivities/PluginGaletteActivities.php @@ -152,7 +152,7 @@ public function getBatchActions(): array public function isInstalled(): bool { return - $this->zdb->tableExists(ACTIVITIES_PREFIX . Activity::TABLE) && - $this->zdb->tableExists(ACTIVITIES_PREFIX . Subscription::TABLE); + $this->zdb->tableExists(ACTIVITIES_PREFIX . Activity::TABLE) + && $this->zdb->tableExists(ACTIVITIES_PREFIX . Subscription::TABLE); } }