Skip to content

Merge pull request #415 from JLG-WOCFR-DEV/codex/add-label-to-file-in… #486

Merge pull request #415 from JLG-WOCFR-DEV/codex/add-label-to-file-in…

Merge pull request #415 from JLG-WOCFR-DEV/codex/add-label-to-file-in… #486

Workflow file for this run

name: PHP Unit Tests
on:
push:
branches: ["main", "master"]
pull_request:
jobs:
phpunit:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: wordpress_test
MYSQL_USER: wp
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root
ports: ['3306:3306']
options: >-
--health-cmd="mysqladmin ping -h localhost -uroot -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
php-version: ['8.1', '8.2']
env:
WP_TESTS_DB_NAME: wordpress_test
WP_TESTS_DB_USER: wp
WP_TESTS_DB_PASSWORD: password
WP_TESTS_DB_HOST: 127.0.0.1
WP_TESTS_TABLE_PREFIX: wptests_
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/composer
supersede-css-jlg-enhanced/vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('supersede-css-jlg-enhanced/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
- name: Install dependencies
working-directory: supersede-css-jlg-enhanced
run: composer install --no-interaction --prefer-dist
- name: Prepare database
run: |
mysql -h 127.0.0.1 -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress_test;"
mysql -h 127.0.0.1 -uroot -proot -e "CREATE USER IF NOT EXISTS 'wp'@'%' IDENTIFIED BY 'password';"
mysql -h 127.0.0.1 -uroot -proot -e "GRANT ALL PRIVILEGES ON wordpress_test.* TO 'wp'@'%';"
- name: Run PHPUnit
working-directory: supersede-css-jlg-enhanced
run: vendor/bin/phpunit