Fix failing tests: Update install-wp-tests.sh, Cypress commands, and GitHub Actions workflows
This commit is contained in:
11
.github/actions/create-plugin-zip/action.yml
vendored
Normal file
11
.github/actions/create-plugin-zip/action.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
name: 'Create Plugin Zip'
|
||||
description: 'Creates a zip file of the WordPress plugin, excluding unnecessary files'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Create plugin zip
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p dist
|
||||
zip -r dist/plugin.zip . \
|
||||
-x "node_modules/**" "dist/**" ".git/**" ".github/**" ".wiki/**"
|
||||
31
.github/workflows/code-quality.yml
vendored
31
.github/workflows/code-quality.yml
vendored
@@ -2,9 +2,10 @@ name: Code Quality
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [ main, feature/* ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
phpcs:
|
||||
@@ -12,12 +13,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
with:
|
||||
clean: 'true'
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.30.0
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: mbstring, intl, zip
|
||||
@@ -46,10 +47,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.30.0
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: mbstring, intl, zip
|
||||
@@ -70,10 +71,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.30.0
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: mbstring, intl, zip
|
||||
@@ -91,25 +92,25 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v3.3.2
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarqube-scan-action@master
|
||||
uses: SonarSource/sonarcloud-github-action@5ee4a0e4e1e9c0f7cfde3bf96fd7647b9d897256 # v2.1.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
@@ -118,7 +119,7 @@ jobs:
|
||||
-Dsonar.projectKey=wpallstars_wp-plugin-starter-template-for-ai-coding
|
||||
-Dsonar.organization=wpallstars
|
||||
-Dsonar.sources=.
|
||||
-Dsonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**
|
||||
-Dsonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**,.github/**,.git/**,cypress/**,playground/**,.wiki/**
|
||||
-Dsonar.sourceEncoding=UTF-8
|
||||
continue-on-error: true
|
||||
|
||||
@@ -127,12 +128,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run Codacy Analysis CLI
|
||||
uses: codacy/codacy-analysis-cli-action@v4.3.0
|
||||
uses: codacy/codacy-analysis-cli-action@5cc54a75f9ad8e86bb795a5d3d4f2f70c9baa1a7 # v4.3.0
|
||||
with:
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
verbose: true
|
||||
@@ -146,7 +147,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload SARIF results file
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.2.7
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
continue-on-error: true
|
||||
|
||||
17
.github/workflows/phpunit.yml
vendored
17
.github/workflows/phpunit.yml
vendored
@@ -2,9 +2,10 @@ name: PHPUnit Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [ main, feature/* ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -17,13 +18,13 @@ jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} - WP ${{ matrix.wp }} - ${{ matrix.multisite && 'Multisite' || 'Single Site' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php: [ '7.4', '8.0' ]
|
||||
wp: [ 'latest' ]
|
||||
multisite: [ false, true ]
|
||||
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
@@ -33,25 +34,25 @@ jobs:
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.30.0
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, soap, intl, gd, exif, iconv
|
||||
coverage: none
|
||||
|
||||
|
||||
- name: Install Composer dependencies
|
||||
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
|
||||
|
||||
|
||||
- name: Install WordPress test suite
|
||||
run: |
|
||||
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp }} ${{ matrix.multisite && 'true' || 'false' }}
|
||||
|
||||
|
||||
- name: Run PHPUnit tests
|
||||
run: |
|
||||
if [ "${{ matrix.multisite }}" = "true" ]; then
|
||||
|
||||
6
.github/workflows/playground-tests-fix.yml
vendored
6
.github/workflows/playground-tests-fix.yml
vendored
@@ -19,16 +19,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524a9de5299b6d2bbed # v4.0.2
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Add WordPress Playground CLI to dependencies
|
||||
run: npm install --save-dev @wp-playground/cli
|
||||
|
||||
25
.github/workflows/playground-tests.yml
vendored
25
.github/workflows/playground-tests.yml
vendored
@@ -2,9 +2,10 @@ name: WordPress Playground Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [ main, feature/* ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -22,16 +23,16 @@ jobs:
|
||||
node-version: [18.18, 20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524a9de5299b6d2bbed # v4.0.2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Verify package.json and package-lock.json
|
||||
run: |
|
||||
@@ -47,16 +48,16 @@ jobs:
|
||||
needs: code-quality
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524a9de5299b6d2bbed # v4.0.2
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Add WordPress Playground CLI to dependencies
|
||||
run: npm install --save-dev @wp-playground/cli
|
||||
@@ -94,16 +95,16 @@ jobs:
|
||||
needs: [code-quality, playground-single-test]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524a9de5299b6d2bbed # v4.0.2
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Add WordPress Playground CLI to dependencies
|
||||
run: npm install --save-dev @wp-playground/cli
|
||||
@@ -142,10 +143,10 @@ jobs:
|
||||
needs: code-quality
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: WordPress Performance Tests
|
||||
uses: swissspidy/wp-performance-action@v2.0.3
|
||||
uses: swissspidy/wp-performance-action@b7e3ffcf0fc4a48b62492e021e0ebeb51430ff11 # v2.0.3
|
||||
with:
|
||||
plugins: |
|
||||
./
|
||||
|
||||
46
.github/workflows/sonarcloud.yml
vendored
Normal file
46
.github/workflows/sonarcloud.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: SonarCloud Analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, feature/* ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@5ee4a0e4e1e9c0f7cfde3bf96fd7647b9d897256 # v2.1.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
with:
|
||||
args: >
|
||||
-Dsonar.projectKey=wpallstars_wp-plugin-starter-template-for-ai-coding
|
||||
-Dsonar.organization=wpallstars
|
||||
-Dsonar.sources=.
|
||||
-Dsonar.tests=tests
|
||||
-Dsonar.sourceEncoding=UTF-8
|
||||
-Dsonar.cpd.exclusions=tests/**
|
||||
-Dsonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**,.github/**,.git/**,cypress/**,playground/**,.wiki/**
|
||||
-Dsonar.php.coverage.reportPaths=coverage.xml
|
||||
-Dsonar.php.tests.reportPath=test-report.xml
|
||||
-Dsonar.verbose=true
|
||||
18
.github/workflows/wordpress-tests.yml
vendored
18
.github/workflows/wordpress-tests.yml
vendored
@@ -2,9 +2,10 @@ name: WordPress Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [ main, feature/* ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -22,16 +23,16 @@ jobs:
|
||||
node-version: [18.18, 20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524a9de5299b6d2bbed # v4.0.2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Verify package.json and package-lock.json
|
||||
run: |
|
||||
@@ -56,16 +57,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: code-quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524a9de5299b6d2bbed # v4.0.2
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Install WordPress Playground CLI
|
||||
run: npm install --save-dev @wp-playground/cli
|
||||
@@ -75,6 +76,9 @@ jobs:
|
||||
|
||||
- name: Run tests with WordPress Playground
|
||||
run: |
|
||||
# Set base URL for Cypress
|
||||
export CYPRESS_BASE_URL=http://localhost:8888
|
||||
|
||||
# Start WordPress Playground with our blueprint
|
||||
npx @wp-playground/cli server --blueprint playground/blueprint.json --port 8888 --login &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user