Merge pull request #31 from happyprime/task/update-php-versions #4
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: | ||
| workflow_call: | ||
| inputs: | ||
| secrets: | ||
| composer-auth-token: | ||
| description: 'GitHub token for private Composer dependencies' | ||
| required: false | ||
| jobs: | ||
| phpunit: | ||
| name: PHPUnit (PHP ${{ matrix.php }} with WordPress ${{ matrix.wordpress }}) | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| database: | ||
| image: mysql:latest | ||
| env: | ||
| MYSQL_DATABASE: wordpress_tests | ||
| MYSQL_ROOT_PASSWORD: password | ||
| ports: | ||
| - 3306:3306 | ||
| continue-on-error: ${{ matrix.experimental }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ['7.4', '8.4'] | ||
| wordpress: ['latest'] | ||
| experimental: [false] | ||
| include: | ||
| - php: '8.5' | ||
| wordpress: 'trunk' | ||
| experimental: true | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| coverage: none | ||
| extensions: mysqli | ||
| tools: composer, cs2pr | ||
| - name: Install SVN | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y subversion | ||
| - name: Install WordPress test setup | ||
| env: | ||
| WP_VERSION: ${{ matrix.wordpress }} | ||
| MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | ||
| run: bash bin/install-wp-tests.sh wordpress_test root password "127.0.0.1:$MYSQL_PORT" "$WP_VERSION" | ||
| - name: Cache Composer | ||
| id: cache-composer | ||
| run: | | ||
| echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
| - uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ steps.cache-composer.outputs.dir }} | ||
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-composer- | ||
| - name: Install dependencies | ||
| env: | ||
| COMPOSER_AUTH: ${{ secrets.composer-auth-token && format('{{"github-oauth":{{"github.com":"{0}"}}}}', secrets.composer-auth-token) || '' }} | ||
| run: | | ||
| composer install --prefer-dist --no-progress | ||
| - name: Run tests | ||
| run: composer phpunit | ||