Skip to content

Commit c523fd6

Browse files
committed
Merge branch 'main' into update/brand-aware-footer
* main: (28 commits) NPM(deps): Bump @wordpress/data from 10.39.0 to 10.40.0 NPM Dev(deps-dev): Bump @wordpress/eslint-plugin from 24.1.0 to 24.2.0 NPM Dev(deps-dev): Bump @wordpress/scripts from 31.4.0 to 31.5.0 NPM(deps): Bump @wordpress/dom-ready from 4.39.0 to 4.40.0 NPM(deps): Bump @wordpress/api-fetch from 7.39.0 to 7.40.0 NPM Dev(deps-dev): Bump @wordpress/env from 10.37.0 to 11.0.0 NPM(deps): Bump @wordpress/data from 10.37.0 to 10.39.0 NPM(deps): Bump @newfold/wp-module-runtime from 1.1.3 to 1.2.2 NPM(deps): Bump @reduxjs/toolkit from 2.9.2 to 2.11.2 NPM Dev(deps-dev): Bump stylelint from 16.26.1 to 17.2.0 NPM Dev(deps-dev): Bump playwright from 1.57.0 to 1.58.2 GitHub Actions(deps): Bump shivammathur/setup-php NPM(deps): Bump @wordpress/dom-ready from 4.37.0 to 4.39.0 Composer(deps): Bump newfold-labs/wp-module-ai from 1.3.4 to 1.3.5 NPM Dev(deps-dev): Bump stylelint-scss from 6.14.0 to 7.0.0 Composer(deps): Bump newfold-labs/wp-module-ai from 1.3.3 to 1.3.4 NPM(deps): Bump lodash from 4.17.21 to 4.17.23 NPM Dev(deps-dev): Bump @wordpress/eslint-plugin from 22.22.0 to 24.1.0 NPM(deps): Bump @wordpress/api-fetch from 7.37.0 to 7.39.0 Composer(deps): Bump newfold-labs/wp-module-features from 1.5.1 to 1.5.2 ... # Conflicts: # package-lock.json
2 parents d57386d + 7ae7f50 commit c523fd6

19 files changed

Lines changed: 7608 additions & 2883 deletions

.env.testing

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# WP-Browser configuration
22
# https://wpbrowser.wptestkit.dev/
3+
# Codeception Testing Environment Variables
34

4-
# The location Composer installed johnpbloch/wordpress to
55
WP_ROOT_FOLDER="wordpress"
66

77
TEST_DB_HOST="127.0.0.1"
8-
# This must match the .wp-env.json config
98
TEST_DB_PORT="33306"
109
TEST_DB_USER="root"
1110
TEST_DB_PASSWORD="password"
@@ -14,4 +13,4 @@ TEST_DB_NAME="wp-browser-tests"
1413
TEST_TABLE_PREFIX="wp_"
1514

1615
TEST_SITE_WP_DOMAIN="localhost:8888"
17-
TEST_SITE_ADMIN_EMAIL="email@example.org"
16+
TEST_SITE_ADMIN_EMAIL="admin@example.com"

.env.testing.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# WP-Browser configuration
2+
# https://wpbrowser.wptestkit.dev/
3+
# Codeception Testing Environment Variables
4+
5+
WP_ROOT_FOLDER="wordpress"
6+
7+
TEST_DB_HOST="127.0.0.1"
8+
TEST_DB_PORT="33306"
9+
TEST_DB_USER="root"
10+
TEST_DB_PASSWORD="password"
11+
12+
TEST_DB_NAME="wp-browser-tests"
13+
TEST_TABLE_PREFIX="wp_"
14+
15+
TEST_SITE_WP_DOMAIN="localhost:8888"
16+
TEST_SITE_ADMIN_EMAIL="admin@example.com"

.github/workflows/codecoverage-main.yml

Lines changed: 22 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -13,179 +13,29 @@ on:
1313
- main
1414
workflow_dispatch:
1515

16-
jobs:
16+
permissions:
17+
contents: read
1718

18-
codecoverage:
19+
jobs:
20+
get-repo-name:
1921
runs-on: ubuntu-latest
20-
21-
services:
22-
mysql:
23-
image: mysql:5.7 # Password auth did not work on 8.0 on PHP 7.3, it did seem to work for PHP 7.4+
24-
env: # These are the same username and password as the wp-env container defaults
25-
MYSQL_ROOT_PASSWORD: password
26-
MYSQL_DATABASE: tests-wordpress
27-
ports: # This mapping matches the .wp-env.json configuration
28-
- 33306:3306
29-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
30-
31-
strategy:
32-
matrix: # Supported PHP versions
33-
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
34-
22+
outputs:
23+
repository-name: ${{ steps.repo-name.outputs.name }}
3524
steps:
36-
- name: Checkout
37-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38-
with:
39-
fetch-depth: 0 # attempting to get all branch names.
40-
41-
# TODO: a DEPLOY_KEY is needed to enable gh-pages for the first time (the branch can be created and pushed but
42-
# it will not be reachable as a website).
43-
# Consider @see https://github.com/peaceiris/actions-gh-pages
44-
# - name: Check does gh-pages branch need to be created
45-
# run: |
46-
# git branch -l;
47-
# if [[ $(git branch -l gh-pages) == "" ]]; then
48-
# gh_pages_branch_needed=true;
49-
# echo "gh-pages branch is needed";
50-
# else
51-
# gh_pages_branch_needed=false
52-
# echo "gh-pages branch already exists";
53-
# fi
54-
# echo "GH_PAGES_BRANCH_NEEDED=$gh_pages_branch_needed" >> $GITHUB_ENV;
55-
# mkdir gh-pages
56-
#
57-
# - name: Maybe create gh-pages branch
58-
# if: ${{ env.GH_PAGES_BRANCH_NEEDED }}
59-
# uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
60-
# with:
61-
# github_token: ${{ secrets.GITHUB_TOKEN }}
62-
# publish_dir: ./gh-pages
63-
# force_orphan: true
64-
# allow_empty_commit: true
65-
# commit_message: "🤖 Creating gh-pages branch"
66-
67-
- name: Checkout GitHub Pages branch for code coverage report
68-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
69-
with:
70-
ref: gh-pages
71-
path: gh-pages
72-
73-
- name: Install PHP
74-
uses: shivammathur/setup-php@f89a301251ea3f109745bab3a62be58575f216bf # v2.36.0
75-
with:
76-
php-version: ${{ matrix.php }}
77-
coverage: xdebug
78-
tools: composer, jaschilz/php-coverage-badger
79-
extensions: zip
80-
81-
- name: Read .env.testing
82-
uses: c-py/action-dotenv-to-setenv@925b5d99a3f1e4bd7b4e9928be4e2491e29891d9 # v5
83-
with:
84-
env-file: .env.testing
85-
86-
- name: Run composer install
87-
continue-on-error: true
88-
run: composer install -v
89-
90-
- name: Allow writing to wp-content
91-
if: ${{ hashFiles('wp-content') != '' }} # TODO: This may be incorrect since it's a directory.
92-
run: sudo chmod -R a+w wp-content
93-
94-
# On main, there will be a previous coverage report. On PRs we create a new directory using the commit SHA.
95-
- name: Clear previous code coverage
96-
if: ${{ (matrix.php == '7.3') && (github.ref == 'refs/heads/main') }}
97-
run: |
98-
rm -rf gh-pages/phpunit || true;
99-
mkdir gh-pages/phpunit || true;
25+
- name: Extract repository name
26+
id: repo-name
27+
run: echo "name=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_OUTPUT
10028

101-
- name: Run unit tests
102-
if: ${{ hashFiles('tests/phpunit/bootstrap.php') != '' }} # Only run unit tests if they are present.
103-
run: XDEBUG_MODE=coverage vendor/bin/phpunit --bootstrap tests/phpunit/bootstrap.php --coverage-php tests/_output/unit.cov --debug
104-
105-
- name: Run wpunit tests
106-
run: XDEBUG_MODE=coverage vendor/bin/codecept run wpunit --coverage tests/_output/wpunit.cov --debug
107-
108-
# For PRs, we'll generate the coverage report on each pushed commit
109-
- name: Merge code coverage for PR
110-
if: ${{ matrix.php == '7.3' && github.event_name == 'pull_request' }}
111-
run: |
112-
vendor/bin/phpcov merge --clover clover.xml tests/_output/;
113-
vendor/bin/phpcov merge --clover gh-pages/${{ github.event.pull_request.head.sha }}/phpunit/clover.xml --php gh-pages/${{ github.event.pull_request.head.sha }}/phpunit/phpunit.cov --html gh-pages/${{ github.event.pull_request.head.sha }}/phpunit/html/ tests/_output/;
114-
115-
# On main, we want it output to a different path
116-
- name: Merge code coverage for main
117-
if: ${{ (matrix.php == '7.3') && (github.ref == 'refs/heads/main') }}
118-
run: |
119-
vendor/bin/phpcov merge --clover clover.xml tests/_output/;
120-
vendor/bin/phpcov merge --clover gh-pages/phpunit/clover.xml --php gh-pages/phpunit/phpunit.cov --html gh-pages/phpunit/html/ tests/_output/;
121-
122-
# This makes the coverage percentage available in `{{ steps.coverage-percentage.outputs.coverage-rounded }}`.
123-
- name: Check test coverage
124-
if: ${{ matrix.php == '7.3' }}
125-
uses: johanvanhelden/gha-clover-test-coverage-check@2543c79a701f179bd63aa14c16c6938c509b2cec # v1
126-
id: coverage-percentage
127-
with:
128-
percentage: 25
129-
exit: false
130-
filename: clover.xml
131-
rounded-precision: "0"
132-
133-
# See: https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
134-
- name: Add `.nojekyll` file so code coverage report successfully deploys to gh-pages
135-
if: ${{ (matrix.php == '7.3') }}
136-
working-directory: gh-pages
137-
run: |
138-
touch .nojekyll
139-
git add -- .nojekyll *
140-
141-
- name: Update README coverage badge
142-
if: ${{ (matrix.php == '7.3') && (github.ref == 'refs/heads/main') }} # only commit on main, on the PHP version we're using in production.
143-
run: php-coverage-badger clover.xml gh-pages/phpunit/coverage.svg
144-
145-
- name: Generate PR coverage badge
146-
if: ${{ (matrix.php == '7.3') && github.event_name == 'pull_request' }}
147-
run: php-coverage-badger clover.xml gh-pages/${{ github.event.pull_request.head.sha }}/phpunit/coverage.svg
148-
149-
- name: Commit code coverage to gh-pages
150-
if: ${{ matrix.php == '7.3' }}
151-
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
152-
with:
153-
repository: gh-pages
154-
branch: gh-pages
155-
commit_message: ${{ format('🤖 Save code coverage report to gh-pages {0}%', steps.coverage-percentage.outputs.coverage-rounded) }}
156-
commit_options: ""
157-
env:
158-
GITHUB_TOKEN: "${{ github.token }}"
159-
160-
- name: Add coverage badge to PR comment
161-
if: ${{ matrix.php == '7.3' && github.event_name == 'pull_request' }}
162-
run: |
163-
echo "[![Code Coverage ](https://newfold-labs.github.io/wp-module-help-center/${{ github.event.pull_request.head.sha }}/phpunit/coverage.svg)](https://newfold-labs.github.io/wp-module-help-center/${{ github.event.pull_request.head.sha }}/phpunit/html/)" >> coverage-comment.md
164-
echo "" >> coverage-comment.md
165-
echo "" >> coverage-comment.md
166-
167-
- name: Add coverage report link to PR comment
168-
if: ${{ matrix.php == '7.3' && github.event_name == 'pull_request' }}
169-
run: |
170-
echo "${{ format('[project coverage report {0}%](https://newfold-labs.github.io/wp-module-help-center/{1}/phpunit/html/) @ {2}', steps.coverage-percentage.outputs.coverage-rounded, github.event.pull_request.head.sha, github.event.pull_request.head.sha) }}" >> coverage-comment.md
171-
echo "" >> coverage-comment.md
172-
echo "" >> coverage-comment.md
173-
174-
- name: Add phpcov uncovered lines report to PR comment
175-
if: ${{ matrix.php == '7.3' && github.event_name == 'pull_request' }}
176-
continue-on-error: true # phpcov can fail if there are no uncovered lines
177-
run: |
178-
BRANCHED_COMMIT=$(git rev-list origin..HEAD | tail -n 1);
179-
echo "BRANCHED_COMMIT=$BRANCHED_COMMIT"
180-
git diff $BRANCHED_COMMIT...${{ github.event.pull_request.head.sha }} > branch.diff;
181-
cat branch.diff;
182-
OUTPUT=${vendor/bin/phpcov patch-coverage --path-prefix $(pwd) ./gh-pages/${{ github.event.pull_request.head.sha }}/phpunit/phpunit.cov branch.diff || true}
183-
echo $OUTPUT;
184-
echo "$OUTPUT" >> coverage-comment.md
185-
186-
- name: Add coverage PR comment
187-
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
188-
if: ${{ matrix.php == '7.3' && github.event_name == 'pull_request' }}
189-
with:
190-
message-id: coverage-report
191-
message-path: coverage-comment.md
29+
codecoverage:
30+
needs: get-repo-name
31+
permissions:
32+
contents: write
33+
pull-requests: write
34+
uses: newfold-labs/workflows/.github/workflows/reusable-codecoverage.yml@main
35+
with:
36+
php-versions: '["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
37+
coverage-php-version: '7.4'
38+
repository-name: ${{ needs.get-repo-name.outputs.repository-name }}
39+
minimum-coverage: 25
40+
secrets:
41+
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
# Using PHP 8.1 here for compatibility with the latest WordPress code sniffer rules.
3030
- name: Setup PHP
31-
uses: shivammathur/setup-php@f89a301251ea3f109745bab3a62be58575f216bf # v2.36.0
31+
uses: shivammathur/setup-php@3aeeb0366058fd8efb58f4d53b5717a49bcb5226 # v2.36.0
3232
with:
3333
php-version: '7.3'
3434
coverage: none
@@ -46,7 +46,7 @@ jobs:
4646
if: "!! env.GIT_DIFF"
4747

4848
- name: Cache Composer vendor directory
49-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
49+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
5050
with:
5151
path: ${{ steps.composer-cache.outputs.dir }}
5252
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
/vendor
2424
/wordpress
2525
/wp-content
26+
.env.testing
2627
cypress.env.json

build/index.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'c2e2b898d66fe4f79322');
1+
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '46250b54ef78e9498d33');

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codeception.dist.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ params:
1515
coverage:
1616
enabled: true
1717
include:
18-
- /includes/*
19-
# - /upgrades/*
20-
bootstrap: bootstrap.php
18+
- includes/*
19+
exclude:
20+
- tests/*
21+
- vendor/*
22+
- build/*
23+
- src/*
24+
- languages/*

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
"require-dev": {
2626
"newfold-labs/wp-php-standards": "@stable",
2727
"wp-cli/i18n-command": "^2.6.6",
28-
"johnpbloch/wordpress": "6.9.0",
28+
"johnpbloch/wordpress": "6.9.1",
2929
"lucatume/wp-browser": "*",
3030
"phpunit/phpcov": "*"
3131
},
3232
"require": {
33-
"newfold-labs/wp-module-ai": "^1.3.3",
33+
"newfold-labs/wp-module-ai": "^1.3.5",
3434
"newfold-labs/wp-module-data": "^2.9.2",
35-
"newfold-labs/wp-module-features": "^1.5.0",
35+
"newfold-labs/wp-module-features": "^1.5.2",
3636
"typesense/typesense-php": "^2.0.4"
3737
},
3838
"autoload": {
@@ -88,4 +88,4 @@
8888
"test": "Run tests.",
8989
"test-coverage": "Run tests with coverage, merge coverage and create HTML report."
9090
}
91-
}
91+
}

0 commit comments

Comments
 (0)