From fd7cf1af8685ceca832c64253fb1ba3e4edc0202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sun, 20 Jul 2025 13:46:09 -0300 Subject: [PATCH] Update GitHub actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds tests for PHP 8.4 and PHP 8.5 and uses ramsey/composer-install. Signed-off-by: MaurĂ­cio Meneghini Fauth --- .github/workflows/lint-and-analyse-php.yml | 103 +++++------ .github/workflows/lint-docs.yml | 26 +-- .github/workflows/mutation-tests.yml | 37 ++-- .github/workflows/tests.yml | 196 ++++++++++----------- 4 files changed, 166 insertions(+), 196 deletions(-) diff --git a/.github/workflows/lint-and-analyse-php.yml b/.github/workflows/lint-and-analyse-php.yml index 6e4c8573d..7e746b3bd 100644 --- a/.github/workflows/lint-and-analyse-php.yml +++ b/.github/workflows/lint-and-analyse-php.yml @@ -3,61 +3,52 @@ name: Lint and analyse php files on: push: pull_request: - types: [opened, synchronize, reopened] + types: [ opened, synchronize, reopened ] jobs: - lint-php: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Use php 7.2 - uses: shivammathur/setup-php@v2 - with: - php-version: 7.2 - tools: composer:v2 - - name: Validate composer.json and composer.lock - run: composer validate - - name: Cache module - uses: actions/cache@v3 - with: - path: ~/.composer/cache/ - key: composer-cache - - name: Install dependencies - run: composer install - - name: Lint files - run: composer run phpcs - - analyse-php: - runs-on: ubuntu-latest - strategy: - matrix: - php-version: ["7.4"] - steps: - - uses: actions/checkout@v3 - - name: Use PHP ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - tools: composer:v2 - - - name: Get Composer cache directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }} - restore-keys: | - composer-${{ runner.os }}-${{ matrix.php-version }}- - - - name: Install dependencies - run: composer install - - name: Analyse files with PHPStan - run: composer run phpstan - - name: Analyse files with Psalm - # Allow the previous check to fail but not abort - if: always() - run: composer run psalm -- --shepherd + lint-php: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ '7.2' ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 + + - name: Check coding-standard + run: composer run phpcs + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + analyse-php: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ '7.4' ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 + + - name: Analyse files with PHPStan + run: composer run phpstan + + - name: Analyse files with Psalm + if: always() + run: composer run psalm -- --shepherd diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 66201cfd1..d9aef0297 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -1,18 +1,20 @@ -name: lint php documentation +name: Lint PHP documentation on: push: pull_request: - types: [opened, synchronize, reopened] + types: [ opened, synchronize, reopened ] jobs: - lint-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: lint php documentation - uses: sudo-bot/action-doctum@v5 - with: - config-file: tools/doctum-config.php - method: "parse" - cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors" + lint-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: lint php documentation + uses: sudo-bot/action-doctum@v5 + with: + config-file: tools/doctum-config.php + method: "parse" + cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors" diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 1fc95b942..068e313a2 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -2,54 +2,37 @@ name: Mutation tests on: push: - branches: [master] + branches: [ master ] pull_request: - branches: [master] + branches: [ master ] jobs: tests: name: Mutation tests with PHP ${{ matrix.php-version }} - runs-on: ${{ matrix.operating-system }} - strategy: matrix: - php-version: ["8.1"] - operating-system: [ubuntu-latest] - + php-version: [ '8.1' ] + operating-system: [ ubuntu-latest ] steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 - name: Fetch github.base_ref (for diffing) if: ${{ github.base_ref != '' }} run: | git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }} - - name: Install PHP ${{ matrix.php-version }} + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} coverage: pcov ini-values: memory_limit=-1 - tools: composer:v2, infection - - - name: Get Composer cache directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }} - restore-keys: | - composer-${{ runner.os }}-${{ matrix.php-version }}- + tools: infection - - name: Install dependencies - run: | - composer update --no-interaction --no-progress + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 - name: Collect coverage report run: composer run phpunit -- --stop-on-failure diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6b860b53c..e6a3ddfd6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,107 +3,101 @@ name: Run tests on: push: pull_request: - types: [opened, synchronize, reopened] + types: [ opened, synchronize, reopened ] jobs: - test-php: - name: Test on PHP ${{ matrix.php-version }} and ${{ matrix.os }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - matrix: - php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] - os: [ubuntu-latest] - experimental: [false] - composer-options: [''] - include: - - { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs' } - steps: - - uses: actions/checkout@v3 - with: - # Fetch some commits for Scrutinizer coverage upload - fetch-depth: 15 - - name: Use PHP ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - # phar, json and curl are used by composer - # json is used by testing code - # dom, json, mbstring, libxml, xml, xmlwriter are used by phpunit - # tokenizer, xmlwriter and simplexml are used by phpcs - # ctype is used by Psalm - extensions: none, mbstring, phar, json, curl, tokenizer, xml, xmlwriter, simplexml, libxml, dom, ctype - coverage: xdebug - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Restore cache - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - name: Install dependencies - run: composer install --no-interaction ${{ matrix.composer-options }} - - name: Install motranslator - if: ${{ matrix.php-version == '7.2' }} - run: composer require phpmyadmin/motranslator:^3.0 --with-all-dependencies --no-interaction - - name: Run php tests - run: composer run phpunit - - name: Send coverage - uses: codecov/codecov-action@v3 - - name: Send coverage to Scrutinizer - uses: sudo-bot/action-scrutinizer@latest - # Do not run this step on forked versions of the main repository (example: contributor forks) - if: github.repository == 'phpmyadmin/sql-parser' - with: - cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}" + test-php: + name: Test on PHP ${{ matrix.php-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] + os: [ ubuntu-latest ] + experimental: [ false ] + composer-options: [ '' ] + include: + - { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+' } + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # Fetch some commits for Scrutinizer coverage upload + fetch-depth: 15 - php-benchmark: - name: Benchmark on PHP ${{ matrix.php-version }} and ${{ matrix.os }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - matrix: - php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] - os: [ubuntu-latest] - experimental: [false] - composer-options: [''] - include: - - { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs' } - steps: - - uses: actions/checkout@v3 - with: - # Fetch some commits for Scrutinizer coverage upload - fetch-depth: 15 - - name: Use PHP ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - # phar, json and curl are used by composer - # json is used by testing code - # dom, json, mbstring, libxml, xml, xmlwriter are used by phpunit - # tokenizer, xmlwriter and simplexml are used by phpcs - # ctype is used by Psalm - extensions: none, mbstring, phar, json, curl, tokenizer, xml, xmlwriter, simplexml, libxml, dom, ctype - coverage: xdebug - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Restore cache - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - name: Install dependencies - run: composer install --no-interaction ${{ matrix.composer-options }} - - name: Install motranslator - if: ${{ matrix.php-version == '7.2' }} - run: composer require phpmyadmin/motranslator:^3.0 --with-all-dependencies --no-interaction - - name: Run benchmarks - run: composer run phpbench + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + # phar, json and curl are used by composer + # json is used by testing code + # dom, json, mbstring, libxml, xml, xmlwriter are used by phpunit + # tokenizer, xmlwriter and simplexml are used by phpcs + # ctype is used by Psalm + extensions: none, mbstring, phar, json, curl, tokenizer, xml, xmlwriter, simplexml, libxml, dom, ctype + coverage: xdebug + + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 + with: + composer-options: ${{ matrix.composer-options }} + + - name: Install phpmyadmin/motranslator + if: ${{ matrix.php-version == '7.2' }} + run: composer require phpmyadmin/motranslator:^3.0 --with-all-dependencies --no-interaction + + - name: Run PHP tests + run: composer run phpunit + + - name: Send coverage + uses: codecov/codecov-action@v3 + + - name: Send coverage to Scrutinizer + uses: sudo-bot/action-scrutinizer@latest + # Do not run this step on forked versions of the main repository (example: contributor forks) + if: github.repository == 'phpmyadmin/sql-parser' + with: + cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}" + + php-benchmark: + name: Benchmark on PHP ${{ matrix.php-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] + os: [ ubuntu-latest ] + experimental: [ false ] + composer-options: [ '' ] + include: + - { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+' } + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # Fetch some commits for Scrutinizer coverage upload + fetch-depth: 15 + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + # phar, json and curl are used by composer + # json is used by testing code + # dom, json, mbstring, libxml, xml, xmlwriter are used by phpunit + # tokenizer, xmlwriter and simplexml are used by phpcs + # ctype is used by Psalm + extensions: none, mbstring, phar, json, curl, tokenizer, xml, xmlwriter, simplexml, libxml, dom, ctype + coverage: xdebug + + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 + with: + composer-options: ${{ matrix.composer-options }} + + - name: Install phpmyadmin/motranslator + if: ${{ matrix.php-version == '7.2' }} + run: composer require phpmyadmin/motranslator:^3.0 --with-all-dependencies --no-interaction + + - name: Run benchmarks + run: composer run phpbench