update tests script #105
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: /github/home/wp-tests/wordpress-tests-lib | |
WP_CORE_DIR: /github/home/wp-tests/wordpress | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7.27 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
steps: | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
coverage: none | |
tools: composer, cs2pr | |
- name: Install NodeJS | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '13.x' | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Composer cache | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: composer-${{ hashFiles( '.github/workflows/main.yml' ) }}-${{ hashFiles( 'composer.lock' ) }} | |
- name: NodeJS cache | |
id: node-cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node-${{ hashFiles( '.github/workflows/main.yml' ) }}-${{ hashFiles( 'package-lock.json' ) }} | |
- name: WordPress test suite cache | |
id: wp-test-suite | |
uses: actions/cache@v3 | |
with: | |
path: /github/home/wp-tests | |
key: wp-tests-${{ hashFiles( '.github/workflows/main.yml' ) }} | |
- name: Install Composer dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: | | |
composer install | |
composer set-coding-standards | |
- name: Install NodeJS dependencies | |
if: steps.node-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Install WordPress test suite | |
run: bash ./.bin/install-wp-tests.sh wordpress_test root root mysql latest | |
- name: PHP Coding standards | |
run: composer run lint | |
- name: JavaScript Coding standards | |
run: npm run lint-js | |
- name: CSS Coding standards | |
run: npm run lint-css | |
- name: Tests | |
run: composer run test |