Use groups_$action_member()
function to manage memberships
#287
Workflow file for this run
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: | |
push: | |
branches: [ master ] | |
jobs: | |
tests: | |
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }}" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['7.4', '8.0', '8.1', '8.2', '8.3'] | |
wp_version: ['master'] | |
include: | |
- php: '8.0' | |
wp_version: '6.4' | |
- php: '7.4' | |
wp_version: '6.4' | |
- php: '7.4' | |
wp_version: '6.1' | |
env: | |
WP_ENV_PHP_VERSION: ${{ matrix.php }} | |
WP_VERSION: ${{ matrix.wp_version }} | |
steps: | |
- name: Cancel previous runs of this workflow (pull requests only) | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check Gitignored files | |
run: if [[ ! -z $(git ls-files -i --exclude-standard) ]]; then exit 1; fi | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2 | |
coverage: none | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '>=20.10.0' | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v3 | |
with: | |
composer-options: "--ignore-platform-reqs --optimize-autoloader" | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Validate node modules | |
run: if [[ -f package.json ]]; then npm audit --audit-level=high --omit=dev --cache ~/.npm; fi | |
- name: Install node modules | |
run: npm ci --cache ~/.npm | |
- name: Setup WordPress | |
run: echo "{\"core\":\"WordPress/WordPress#${WP_VERSION}\"}" >> .wp-env.override.json | |
- name: Install WordPress | |
run: | | |
chmod -R 767 ./ | |
npm run wp-env start -- --update | |
- name: Running single site unit tests | |
run: npm run test-php | |
if: ${{ success() || failure() }} | |
- name: Running multisite unit tests | |
run: npm run test-php-multisite | |
if: ${{ success() || failure() }} | |
- name: Stop Docker environment | |
run: npm run wp-env stop | |
if: ${{ success() || failure() }} |