Merge pull request #168 from WordPress/fix/date-time #191
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: Unit Tests | |
on: | |
pull_request: | |
paths: | |
- '**.php' | |
- '*.json' | |
- '*.xml.dist' | |
push: | |
paths: | |
- '**.php' | |
- '*.json' | |
- '*.xml.dist' | |
branches: | |
- master | |
jobs: | |
phpcs: | |
name: PHP CodeSniffer | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
coverage: none | |
tools: composer, cs2pr | |
- name: Install Composer dependencies | |
run: | | |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction | |
- name: Run PHPCS | |
run: | | |
vendor/bin/phpcs -q --report=checkstyle src | cs2pr | |
unit-php: | |
name: PHP Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Npm install and build | |
run: | | |
npm ci | |
npm run build | |
- name: composer install | |
run: | | |
composer install | |
- name: Install WordPress | |
run: | | |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env | |
npm run wp-env start | |
- name: Run unit tests | |
run: npm run test:unit-php | |
if: ${{ success() || failure() }} |