Merge pull request #338 from NekoJonez/patch-1 #600
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: PHPUnit | |
on: | |
push: | |
branches: | |
- develop | |
- trunk | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
check-diffs: | |
runs-on: ubuntu-latest | |
outputs: | |
has_changed: ${{ steps.files-changed.outputs.RSA_PHP_FILES_CHANGED }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get updated PHP files | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: | | |
**/*.php | |
- id: files-changed | |
run: | | |
if [[ ( "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ) || "${{ github.event_name }}" == "push" ]]; then | |
echo "RSA_PHP_FILES_CHANGED=yes" >> $GITHUB_OUTPUT | |
fi | |
phpunit: | |
runs-on: ubuntu-latest | |
needs: check-diffs | |
if: needs.check-diffs.outputs.has_changed == 'yes' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: getong/[email protected] | |
- name: Set PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
coverage: none | |
tools: composer:v2 | |
- name: Install dependencies | |
run: composer install | |
- name: install node v16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Install dependencies | |
run: npm i && npm run build | |
- name: Setup WP Tests | |
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 | |
- name: PHPUnit | |
run: './vendor/bin/phpunit' |