Pin all floating version tags (@v1, @v2, @v3, @v4, @master) to full commit SHAs across all workflow files to eliminate supply chain security risk. Actions pinned: - actions/checkout@v3 -> f43a0e5 (v3.6.0) in release.yml, sync-wiki.yml - actions/checkout@v4 -> 34e1148 (v4) in tests.yml - shivammathur/setup-php@v2 -> accd612 (v2) in all workflows - actions/setup-node@v4 -> 49933ea (v4) in playground-tests*.yml, wordpress-tests.yml - actions/upload-artifact@v4 -> ea165f8 (v4) in playground-tests*.yml, wordpress-tests.yml - softprops/action-gh-release@v1 -> de2c0eb (v1) in release.yml - codacy/codacy-analysis-cli-action@v4 -> 562ee3e (v4) in code-quality.yml - github/codeql-action/upload-sarif@v3 -> 603b797 (v3) in code-quality.yml - swissspidy/wp-performance-action@v2.0.3 -> b7e3ffc (v2.0.3) in playground-tests.yml - SonarSource/sonarqube-scan-action@master -> 9598b8a in sonarcloud.yml Closes #89
107 lines
3.3 KiB
YAML
107 lines
3.3 KiB
YAML
name: WordPress Playground Tests Fix
|
|
|
|
# DISABLED: WordPress Playground CLI doesn't work reliably in GitHub Actions CI environments
|
|
# The server fails to start within timeout periods. These tests should be run locally instead.
|
|
|
|
on:
|
|
# Disable automatic triggers - only run manually if needed for debugging
|
|
workflow_dispatch:
|
|
inputs:
|
|
debug:
|
|
description: 'Enable debug mode'
|
|
required: false
|
|
default: 'false'
|
|
|
|
# Commented out triggers that cause CI noise:
|
|
# push:
|
|
# branches: [ main, feature/* ]
|
|
# pull_request:
|
|
# branches: [ main ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
playground-test:
|
|
name: WordPress Playground Tests
|
|
runs-on: ubuntu-latest
|
|
# Allow failures since WordPress Playground CLI can be unreliable in CI environments
|
|
continue-on-error: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm install --legacy-peer-deps
|
|
|
|
- name: Add WordPress Playground CLI to dependencies
|
|
run: |
|
|
echo "Installing WordPress Playground CLI..."
|
|
npm install --save-dev @wp-playground/cli @wp-playground/blueprints @wp-playground/client
|
|
echo "WordPress Playground CLI installed"
|
|
npx @wp-playground/cli --version
|
|
|
|
- name: Create plugin zip
|
|
uses: ./.github/actions/create-plugin-zip
|
|
|
|
- name: Run tests with WordPress Playground
|
|
run: |
|
|
# Set base URL for Cypress
|
|
export CYPRESS_BASE_URL=http://localhost:8888
|
|
|
|
# Check if blueprint file exists
|
|
echo "Checking blueprint file..."
|
|
ls -la playground/
|
|
cat playground/blueprint.json
|
|
|
|
# Start WordPress Playground with our blueprint
|
|
echo "Starting WordPress Playground server..."
|
|
npx @wp-playground/cli server --blueprint playground/blueprint.json --port 8888 --login &
|
|
SERVER_PID=$!
|
|
|
|
# Wait for WordPress Playground to be ready (increased timeout to 180s)
|
|
echo "Waiting for WordPress Playground to be ready..."
|
|
TIMEOUT=180
|
|
ELAPSED=0
|
|
while ! curl -s http://localhost:8888 > /dev/null 2>&1; do
|
|
if [ $ELAPSED -ge $TIMEOUT ]; then
|
|
echo "Timeout waiting for WordPress Playground to start"
|
|
kill $SERVER_PID || true
|
|
exit 1
|
|
fi
|
|
echo "Waiting... ($ELAPSED/$TIMEOUT seconds)"
|
|
sleep 5
|
|
ELAPSED=$((ELAPSED + 5))
|
|
done
|
|
echo "WordPress Playground is ready after $ELAPSED seconds"
|
|
|
|
# Run Cypress tests against WordPress Playground
|
|
echo "Running Cypress tests..."
|
|
npx cypress run --spec "cypress/e2e/playground-single-site.cy.js"
|
|
TEST_EXIT_CODE=$?
|
|
|
|
# Kill the server process
|
|
kill $SERVER_PID || true
|
|
|
|
# Return the test exit code
|
|
exit $TEST_EXIT_CODE
|
|
|
|
- name: Upload Cypress artifacts
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: cypress-playground-results
|
|
path: |
|
|
cypress/videos
|
|
cypress/screenshots
|