Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- 'main-built'

jobs:
test:
e2e:
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
Expand All @@ -20,6 +20,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '20.11'
cache: 'yarn'

- name: Cache Composer dependencies
uses: actions/cache@v4
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
- 'main-built'

jobs:
build:
name: Lint & Test
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -15,6 +14,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.11
cache: 'yarn'

- name: Install packages
run: yarn install --immutable
Expand All @@ -24,3 +24,11 @@ jobs:

- name: JS test
run: yarn test:js

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: js-report
path: js-report/
retention-days: 30
67 changes: 49 additions & 18 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,31 @@ on:

jobs:
lint-test:
name: ${{ matrix.php-versions }} Lint & Test
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['8.3']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.11'
cache: 'yarn'

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2

- name: Validate Composer
run: composer validate --strict

- name: Install dependencies
run: composer install --prefer-dist
- name: Setup composer
uses: php-actions/composer@v6
with:
php_version: '8.3'

- name: PHP Lint
run: composer lint
Expand All @@ -48,5 +41,43 @@ jobs:
- name: PHPMD
run: composer phpmd

- name: Install wp-env
run: yarn add @wordpress/env -D

- name: Start wp-env
run: yarn wp-env:coverage

- name: WordPress unit test
run: composer test:unit
run: yarn php:unit

- name: Unit test coverage report
uses: codecov/codecov-action@v4
with:
files: ./unit-coverage.xml
flags: unittests
name: codecov-unit
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: WordPress integration test
run: yarn php:integration

- name: Integration test coverage report
uses: codecov/codecov-action@v4
with:
files: ./integration-coverage.xml
flags: integrationtests
name: codecov-integration
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: WordPress integration test as multisite
run: yarn php:multisite

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: php-report
path: php-report/
retention-days: 30
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ vendor
build
yarn-error.log
.phpunit.result.cache
.phpunit.cache
.DS_Store
testingdb
.env
Expand All @@ -14,3 +15,5 @@ tests-examples/
/blob-report/
/playwright/.cache/
build-script.sh
integration-coverage.xml
unit-coverage.xml
9 changes: 8 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"core": null,
"plugins": ["."],
"phpVersion": "8.3"
"phpVersion": "8.3",
"env": {
"tests": {
"mappings": {
"wp-content/plugins/feature-flags": "."
}
}
}
}
155 changes: 0 additions & 155 deletions bin/install-wp-tests.sh

This file was deleted.

13 changes: 3 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@
"newsuk/nuk-wp-phpmd-config": "^0.1.0",
"newsuk/nuk-wp-phpstan-config": "^0.1.0",
"phpunit/phpunit": "^9.4",
"wordpress/wordpress": "^6.4",
"yoast/wp-test-utils": "^1.2"
},
"repositories": [
{
"type": "vcs",
"url": "https://git@github.com/WordPress/wordpress-develop"
}
],
"autoload": {
"psr-4": {
"CodeB\\FeatureFlags\\": [
Expand Down Expand Up @@ -48,8 +41,8 @@
"phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color",
"phpstan": "phpstan analyse --memory-limit=2048M",
"phpstan-baseline": "phpstan analyse -b --allow-empty-baseline --memory-limit=2048M",
"test:integration": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration.xml --testsuite integration --testdox --coverage-text",
"test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox --coverage-text",
"test:unit": "phpunit --dont-report-useless-tests --configuration ./phpunit.xml --testsuite unit --testdox --coverage-text"
"test:integration": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration.xml --testsuite integration --testdox",
"test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox ",
"test:unit": "phpunit --dont-report-useless-tests --configuration ./phpunit.xml --testsuite unit --testdox"
}
}
Loading