This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
Bump tested up to #49
This file contains 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: Coding Standards and Tests | |
on: [ push ] | |
env: | |
WP_TESTS_DIR: /home/runner/wp-tests/wordpress-tests-lib | |
WP_CORE_DIR: /home/runner/wp-tests/wordpress | |
WP_TESTS_PHPUNIT_POLYFILLS_PATH: $HOME/.composer/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: [ '7.4' ] | |
wordpress-version: [ latest ] | |
services: | |
mysql: | |
image: mysql:5.7.27 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: wordpress_test | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
coverage: none | |
tools: composer, cs2pr | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Composer cache | |
id: composer-cache | |
uses: actions/cache@v2 | |
with: | |
path: /home/runner/.composer/vendor | |
key: composer-${{ hashFiles( '.github/workflows/main.yml' ) }}-${{ matrix.wordpress-version }} | |
- name: WordPress test suite cache | |
id: wp-test-suite | |
uses: actions/cache@v2 | |
with: | |
path: /home/runner/wp-tests | |
key: wp-tests-${{ hashFiles( '.github/workflows/main.yml' ) }}-${{ matrix.wordpress-version }} | |
- name: Install Composer dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: | | |
composer global require "phpunit/phpunit=5.7.*" | |
composer global require wp-coding-standards/wpcs | |
composer global require yoast/phpunit-polyfills | |
$HOME/.composer/vendor/bin/phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs | |
- name: Install WordPress test suite | |
run: bash bin/install-wp-tests.sh wordpress_test root root 0.0.0.0 ${{ matrix.wordpress-version }} true | |
- name: Coding standards | |
run: $HOME/.composer/vendor/bin/phpcs phpcs.ruleset.xml | |
- name: Tests | |
run: $HOME/.composer/vendor/bin/phpunit |