Skip to content

Add per-post toggle for co-author edit access after publish (#19) #56

Add per-post toggle for co-author edit access after publish (#19)

Add per-post toggle for co-author edit access after publish (#19) #56

Workflow file for this run

name: Tests
on:
push:
branches:
- trunk
- 'copilot/**'
pull_request:
branches:
- trunk
- 'copilot/**'
jobs:
# ---------------------------------------------------------------------------
# JavaScript unit tests (Jest, no Docker needed)
# ---------------------------------------------------------------------------
js-tests:
name: JS Unit Tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# No cache — lock file is not committed.
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Run JS unit tests
run: npm run test:unit
# ---------------------------------------------------------------------------
# PHP unit tests — run inside wp-env (Docker)
# ---------------------------------------------------------------------------
php-tests:
name: "PHP ${{ matrix.php }} Tests (wp-env)"
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
# PRs test only the oldest and newest supported versions.
# Pushes to trunk/copilot branches test the full range.
php: ${{ github.event_name == 'push' && fromJSON('["7.4","8.0","8.1","8.2","8.3","8.4","8.5"]') || fromJSON('["7.4","8.5"]') }}
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# No cache — lock file is not committed.
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Override PHP version
run: |
echo '{ "phpVersion": "${{ matrix.php }}" }' > .wp-env.override.json
- name: Start wp-env
run: npx wp-env start
env:
# wp-env pulls Docker images; increase timeout for CI.
WP_ENV_LIFECYCLE_TIMEOUT: 300
- name: Install Composer dependencies
run: npx wp-env run cli --env-cwd=wp-content/plugins/multi-author-posts -- composer install --no-interaction
- name: Run PHP tests via wp-env
run: npx wp-env run cli --env-cwd=wp-content/plugins/multi-author-posts -- vendor/bin/phpunit
- name: Stop wp-env
if: always()
run: npx wp-env stop