Fix code quality issues and GitHub Actions workflows

This commit is contained in:
2025-04-22 22:30:31 +01:00
parent f3d6bd2434
commit 0c4e91fcec
10 changed files with 61 additions and 22 deletions

View File

@@ -2,12 +2,15 @@ name: WordPress Playground Tests Fix
on:
push:
branches: [ main, feature/*, bugfix/* ]
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
concurrency:
group: playground-tests-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
@@ -31,10 +34,7 @@ jobs:
run: npm install --save-dev @wp-playground/cli
- name: Create plugin zip
run: |
mkdir -p dist
zip -r dist/plugin.zip . \
-x "node_modules/**" "dist/**" ".git/**" ".github/**" ".wiki/**"
uses: ./.github/actions/create-plugin-zip
- name: Run tests with WordPress Playground
run: |

View File

@@ -6,6 +6,9 @@ on:
pull_request:
branches: [ main ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@@ -111,15 +114,15 @@ jobs:
- name: Run tests with WordPress Playground
run: |
# Set base URL for Cypress
export CYPRESS_BASE_URL=http://localhost:80
export CYPRESS_BASE_URL=http://localhost:8889
# Start WordPress Playground with our blueprint
# Use port 80 for multisite to avoid port configuration issues with WP Playground CLI
npx @wp-playground/cli server --blueprint playground/multisite-blueprint.json --port 80 --login &
# Use a different port for multisite to avoid conflicts with single site tests
npx @wp-playground/cli server --blueprint playground/multisite-blueprint.json --port 8889 --login &
# Wait for WordPress Playground to be ready
echo "Waiting for WordPress Playground to be ready..."
timeout 60 bash -c 'until curl -s http://localhost:80; do sleep 2; done'
timeout 60 bash -c 'until curl -s http://localhost:8889; do sleep 2; done'
# Run Cypress tests against WordPress Playground
npx cypress run --spec "cypress/e2e/playground-multisite.cy.js"

View File

@@ -2,10 +2,17 @@ name: WordPress Tests
on:
push:
branches: [ main, feature/*, bugfix/* ]
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
code-quality:
name: Code Quality Check
@@ -61,21 +68,28 @@ jobs:
run: npm ci
- name: Install WordPress Playground CLI
run: npm install -g @wordpress/playground-tools
run: npm install --save-dev @wp-playground/cli
- name: Create plugin zip
run: |
mkdir -p dist
zip -r dist/plugin.zip . -x "node_modules/*" "dist/*" ".git/*"
uses: ./.github/actions/create-plugin-zip
- name: Run tests with WordPress Playground
run: |
# Start WordPress Playground with our blueprint
wp-playground start --blueprint playground/blueprint.json --port 8888 &
npx @wp-playground/cli server --blueprint playground/blueprint.json --port 8888 --login &
# Wait for WordPress Playground to be ready
echo "Waiting for WordPress Playground to be ready..."
timeout 60 bash -c 'until curl -s http://localhost:8888; do sleep 2; done'
# Run tests against WordPress Playground
npm run test:playground:single
npx cypress run --spec "cypress/e2e/playground-single-site.cy.js"
- name: Upload Cypress artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-results
path: |
cypress/videos
cypress/screenshots