Merge pull request #8 from peterwilsoncc/use-safe-remote-request #52
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: PHP Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
phpunit: | |
runs-on: ubuntu-latest | |
env: | |
DB_DATABASE: wordpress_test | |
DB_USER: root | |
DB_PASSWORD: root | |
strategy: | |
fail-fast: false | |
matrix: | |
wp-versions: [ '6.3', '6.4', '6.5', '6.6', '6.7', '6.8', 'latest', 'trunk' ] | |
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] | |
exclude: | |
- wp-versions: '6.3' | |
php-versions: '8.3' | |
- wp-versions: '6.3' | |
php-versions: '8.4' | |
- wp-versions: '6.4' | |
php-versions: '8.4' | |
- wp-versions: '6.5' | |
php-versions: '8.4' | |
- wp-versions: '6.6' | |
php-versions: '8.4' | |
name: WP ${{ matrix.wp-versions }} / PHP ${{ matrix.php-versions }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Install Subversion. | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y subversion | |
- name: Check PHP Version | |
run: php -v | |
- name: Composer install | |
run: composer install --optimize-autoloader --prefer-dist | |
- name: Install WP Tests | |
run: | | |
sudo /etc/init.d/mysql start | |
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp-versions }} | |
- name: PHPUnit tests | |
run: ./vendor/bin/phpunit | |
env: | |
WP_TESTS_DIR: ${{ runner.temp }}/wordpress-tests-lib | |
WP_CORE_DIR: ${{ runner.temp }}/wordpress | |
required-status-checks: | |
name: PHPUnit Required Status Checks | |
runs-on: 'ubuntu-24.04' | |
needs: [ 'phpunit' ] | |
if: ${{ always() }} | |
steps: | |
- name: Detect any failing status checks | |
run: | | |
[[ "${{ join(needs.*.result, ' ') }}" =~ ^(success ?)+$ ]] || exit 1 |