update wordPressPlugin workflow #570
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHPUnit | |
| on: [push, pull_request, workflow_dispatch] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| run: | |
| runs-on: ${{ matrix.operating-system }} | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: | |
| operating-system: [ubuntu-latest] | |
| php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] | |
| name: PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }} | |
| env: | |
| MYSQL_DATABASE: test | |
| MYSQL_USERNAME: root | |
| MYSQL_PASSWORD: root | |
| COVERAGE_VER: '8.3' | |
| steps: | |
| - name: Set up MySQL | |
| run: | | |
| # Start MySQL service | |
| sudo /etc/init.d/mysql start --default-auth=mysql_native_password | |
| mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USERNAME }} -p${{ env.MYSQL_PASSWORD }} | |
| echo "MySQL version: $(mysqld --version)" | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.1 | |
| - name: Install PHP | |
| uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: iconv, intl, mysqli, oauth | |
| ini-values: error_reporting=-1, memory_limit=512M, post_max_size=256M, xdebug.mode="coverage,debug,develop" | |
| coverage: xdebug #optional | |
| - name: Check PHP Version | |
| run: | | |
| php -v | |
| php -r 'echo "curl version: " . curl_version()["version"] . "\n";' | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate --strict | |
| - name: Cache composer packages | |
| uses: actions/cache@v4 | |
| id: composer-cache | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: | | |
| composer --version | |
| composer install --prefer-dist --no-progress | |
| - name: Unit test | |
| # This step runs tests for all PHP versions except where we're collecting coverage in the next step | |
| if: ${{ matrix.php-version != env.COVERAGE_VER || github.ref_name != 'master' }} | |
| run: composer run test | |
| - name: Run code coverage | |
| if: ${{ matrix.php-version == env.COVERAGE_VER && github.ref_name == 'master' }} | |
| run: | | |
| vendor/bin/phpunit --coverage-clover coverage/clover.xml | |
| php -f vendor/bdk/devutil/src/coverageChecker.php -- coverage/clover.xml | |
| - name: Publish code coverage | |
| if: ${{ matrix.php-version == env.COVERAGE_VER && github.ref_name == 'master' }} | |
| uses: qltysh/qlty-action/coverage@v1 | |
| with: | |
| files: coverage/clover.xml | |
| oidc: true |