Skip to content

PHPUnit Tests (Legacy 8.x) #30

PHPUnit Tests (Legacy 8.x)

PHPUnit Tests (Legacy 8.x) #30

name: PHPUnit Tests (Legacy 8.x)
on:
push:
branches:
- main
- development
pull_request:
branches:
types: [closed]
schedule:
- cron: '0 0 * * 0'
jobs:
test-php:
name: WordPress ${{ matrix.wordpress-versions }} - PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
services:
mysql-service:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
php-versions: [ '8.1', '8.0' ]
wordpress-versions: [ '6.4', '6.3', '6.2', '6.1', '6.0' ]
operating-system: [ ubuntu-22.04 ]
env:
UTMDC_BITLY_API: ${{secrets.UTMDC_BITLY_API}}
UTMDC_REBRANDLY_API: ${{secrets.UTMDC_REBRANDLY_API}}
UTMDC_PLUGIN_DIR: ${{secrets.UTMDC_PLUGIN_DIR}}
steps:
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Setup PHP
# Commit hash for v2.32.0: https://github.com/shivammathur/setup-php/releases/tag/2.32.0
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
- name: Log Debug Information
run: |
echo "$GITHUB_REF"
echo "$GITHUB_EVENT_NAME"
php --version
mysql --version
lsb_release -a
- name: Checkout utm.codes
# Commit hash for v3.5.3: https://github.com/actions/checkout/releases/tag/v4.2.2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Install PHPUnit
run: |
composer require phpunit/phpunit:^9.5 --update-with-dependencies
- name: Install WordPress
run: |
bash _test/bin/install-wp-tests.sh wordpress_test root root localhost:3306 ${{ matrix.wordpress-versions }}
- name: Run PHPUnit Tests
run: |
cd _test
../vendor/bin/phpunit