Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 33 additions & 34 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-maps' && (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-maps' && (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 }}

Expand Down Expand Up @@ -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-maps
../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff
Expand Down Expand Up @@ -101,32 +123,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-maps' || !(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:
Expand Down Expand Up @@ -158,17 +161,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
Expand All @@ -177,7 +178,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 }}
Expand All @@ -195,18 +195,17 @@ 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: |
cd galette-core
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'
run: |
cd galette-core/galette/plugins/plugin-maps
../../vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/GaletteMaps/
Loading