Add GitHub Actions CI, bump minimum PHP to 7.4 and WP to 6.5 #3
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| phpunit: | |
| name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }} | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: wordpress_test | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['7.4', '8.0', '8.1', '8.2', '8.3'] | |
| wp: ['6.5', '6.6', '6.7', '6.8', '6.9'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install SVN | |
| run: sudo apt-get update -q && sudo apt-get install -y subversion | |
| - name: Set up PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: composer | |
| coverage: none | |
| - name: Cache Composer packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('composer.json') }} | |
| restore-keys: ${{ runner.os }}-php-${{ matrix.php }}- | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Install WordPress test suite | |
| run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp }} true | |
| - name: Run PHPUnit | |
| run: vendor/bin/phpunit | |
| - name: Run PHPUnit (multisite) | |
| run: WP_MULTISITE=1 vendor/bin/phpunit | |
| phpcs: | |
| name: PHPCS | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| tools: composer | |
| coverage: none | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Run PHPCS | |
| run: vendor/bin/phpcs |