From 37644e15066a3a69ece6a5d5b21d44231cee7fd9 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Fri, 24 Apr 2026 15:44:15 +0200 Subject: [PATCH] Use core matrix --- .github/workflows/ci-linux.yml | 70 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index dfb00fb..9439447 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -16,26 +16,48 @@ 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-events' && (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-events' && (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 }} - name: Checkout Galette core - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: galette/galette path: galette-core @@ -43,7 +65,7 @@ jobs: ref: develop - name: Checkout plugin - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: galette-core/galette/plugins/plugin-events @@ -53,7 +75,7 @@ jobs: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -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-events ../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff @@ -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-events' || !(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: @@ -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 @@ -177,13 +178,12 @@ 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 }} - name: Checkout plugin - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: galette-core/galette/plugins/plugin-events