From 2d70ffcb956f91da7adf3861ce8440b0e451c80f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 26 Mar 2026 21:30:12 +0100 Subject: [PATCH 1/2] Test workflow --- .github/workflows/testing.yml | 197 +--------------------------------- 1 file changed, 3 insertions(+), 194 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 26403ca..a5b09aa 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,203 +1,12 @@ name: Testing on: + workflow_dispatch: pull_request: push: branches: - main - - master - -# Cancels all previous workflow runs for the same branch that have not yet completed. -concurrency: - # The concurrency group contains the workflow name and the branch name. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true jobs: - - unit: #----------------------------------------------------------------------- - name: Unit test / PHP ${{ matrix.php }} - strategy: - fail-fast: false - matrix: - php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] - runs-on: ubuntu-20.04 - - continue-on-error: ${{ matrix.php == '8.3' }} - - steps: - - name: Check out source code - uses: actions/checkout@v6 - - - name: Check existence of composer.json file - id: check_files - uses: andstor/file-existence-action@v3 - with: - files: "composer.json, phpunit.xml.dist" - - - name: Set up PHP environment (PHP 5.6 - 7.1) - if: ${{ matrix.php < '7.2' && steps.check_files.outputs.files_exists == 'true'}} - uses: shivammathur/setup-php@v2 - with: - php-version: '${{ matrix.php }}' - coverage: none - tools: composer:2.2,cs2pr - env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up PHP environment (PHP 7.2+) - if: ${{ matrix.php >= '7.2' && steps.check_files.outputs.files_exists == 'true'}} - uses: shivammathur/setup-php@v2 - with: - php-version: '${{ matrix.php }}' - coverage: none - tools: composer,cs2pr - env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Install Composer dependencies & cache dependencies - if: steps.check_files.outputs.files_exists == 'true' - uses: "ramsey/composer-install@v4" - env: - COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} - with: - # Bust the cache at least once a month - output format: YYYY-MM. - custom-cache-suffix: $(date -u "+%Y-%m") - - - name: Setup problem matcher to provide annotations for PHPUnit - if: steps.check_files.outputs.files_exists == 'true' - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - - name: Run PHPUnit - if: steps.check_files.outputs.files_exists == 'true' - run: composer phpunit - - functional: #---------------------------------------------------------------------- - name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }} - strategy: - fail-fast: false - matrix: - php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] - wp: ['latest'] - mysql: ['8.0'] - include: - - php: '7.0' - wp: 'trunk' - mysql: '8.0' - - php: '7.0' - wp: 'trunk' - mysql: '5.7' - - php: '7.0' - wp: 'trunk' - mysql: '5.6' - - php: '7.4' - wp: 'trunk' - mysql: '8.0' - - php: '8.0' - wp: 'trunk' - mysql: '8.0' - - php: '8.0' - wp: 'trunk' - mysql: '5.7' - - php: '8.0' - wp: 'trunk' - mysql: '5.6' - - php: '8.1' - wp: 'trunk' - mysql: '8.0' - - php: '8.2' - wp: 'trunk' - mysql: '8.0' - - php: '5.6' - wp: '3.7' - mysql: '5.6' - - php: '5.6' - wp: '6.2' - mysql: '8.0' - - php: '8.3' - wp: 'trunk' - mysql: '8.0' - runs-on: ubuntu-20.04 - - continue-on-error: ${{ matrix.php == '8.3' }} - - services: - mysql: - image: mysql:${{ matrix.mysql }} - ports: - - 3306 - options: --health-cmd="mysqladmin ping" --health-interval=30s --health-timeout=10s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password" - - steps: - - name: Check out source code - uses: actions/checkout@v6 - - - name: Check existence of composer.json & behat.yml files - id: check_files - uses: andstor/file-existence-action@v3 - with: - files: "composer.json, behat.yml" - - - name: Install Ghostscript - if: steps.check_files.outputs.files_exists == 'true' - run: | - sudo apt-get update - sudo apt-get install ghostscript -y - - - name: Set up PHP environment - if: steps.check_files.outputs.files_exists == 'true' - uses: shivammathur/setup-php@v2 - with: - php-version: '${{ matrix.php }}' - extensions: gd, imagick, mysql, zip - coverage: none - tools: composer - env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Change ImageMagick policy to allow pdf->png conversion. - if: steps.check_files.outputs.files_exists == 'true' - run: | - sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml - - - name: Install Composer dependencies & cache dependencies - if: steps.check_files.outputs.files_exists == 'true' - uses: "ramsey/composer-install@v4" - env: - COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} - with: - # Bust the cache at least once a month - output format: YYYY-MM. - custom-cache-suffix: $(date -u "+%Y-%m") - - - name: Start MySQL server - if: steps.check_files.outputs.files_exists == 'true' - run: sudo systemctl start mysql - - - name: Configure DB environment - if: steps.check_files.outputs.files_exists == 'true' - run: | - echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV - echo "MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}" >> $GITHUB_ENV - echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV - echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV - echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV - echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV - echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV - echo "WP_CLI_TEST_DBHOST=127.0.0.1:${{ job.services.mysql.ports['3306'] }}" >> $GITHUB_ENV - - - name: Prepare test database - if: steps.check_files.outputs.files_exists == 'true' - run: composer prepare-tests - - - name: Check Behat environment - if: steps.check_files.outputs.files_exists == 'true' - env: - WP_VERSION: '${{ matrix.wp }}' - run: WP_CLI_TEST_DEBUG_BEHAT_ENV=1 composer behat - - - name: Run Behat - if: steps.check_files.outputs.files_exists == 'true' - env: - WP_VERSION: '${{ matrix.wp }}' - run: composer behat || composer behat-rerun + test: + uses: wp-cli/.github/.github/workflows/reusable-testing.yml@test From fbcd91b0a037e36bd5921f338a8363ec770c4be9 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 26 Mar 2026 21:39:43 +0100 Subject: [PATCH 2/2] test --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 71d4d33..6854072 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "process-timeout": 7200, "sort-packages": true, "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true } }, "extra": {