Skip to content

Merge pull request #4008 from 10up/fix/issue-3995 #5905

Merge pull request #4008 from 10up/fix/issue-3995

Merge pull request #4008 from 10up/fix/issue-3995 #5905

Workflow file for this run

name: Unit Test
env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x
jobs:
phpunit:
name: ${{ matrix.type.name }} - ES ${{ matrix.esVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
esVersion: ['7.10.1', '8.12.2']
type:
- {name: 'Single Site', command: 'test-single-site'}
- {name: 'Multisite', command: 'test'}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Start MySQL
run: sudo systemctl start mysql.service
- name: Setup Elasticsearch
run: cd bin/es-docker/ && docker compose build --build-arg ES_VERSION=${{ matrix.esVersion }} && docker compose up -d
- name: Check ES response
run: curl --connect-timeout 5 --max-time 10 --retry 5 --retry-max-time 40 --retry-all-errors http://127.0.0.1:8890
- name: Set standard 10up cache directories
run: |
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"
- name: Prepare composer cache
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: :php-psr
coverage: none
- name: Install dependencies
run: composer install --ignore-platform-reqs
- name: Setup WP Tests
run: |
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1
sleep 10
- name: PHPUnit
run: |
EP_HOST=http://127.0.0.1:8890/ composer run-script ${{ matrix.type.command }}