Skip to content

Commit cc4ef1a

Browse files
committed
Updated tooling.
1 parent 2d98de1 commit cc4ef1a

File tree

9 files changed

+105
-222
lines changed

9 files changed

+105
-222
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.github/ export-ignore
2+
tests/ export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
.wp-env.json export-ignore
6+
composer.lock export-ignore
7+
package.json export-ignore
8+
package-lock.json export-ignore
9+
phpcs.xml export-ignore
10+
phpunit.env export-ignore
11+
phpunit.xml export-ignore

.github/workflows/php_unit.yml

Lines changed: 52 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -3,121 +3,68 @@ name: Unit Tests
33
# Since Unit Tests are required to pass for each PR,
44
# we cannot disable them for documentation-only changes.
55
on:
6-
pull_request:
7-
push:
8-
# Allow manually triggering the workflow.
9-
workflow_dispatch:
6+
pull_request:
7+
push:
8+
# Allow manually triggering the workflow.
9+
workflow_dispatch:
1010

1111
# Cancels all previous workflow runs for pull requests that have not completed.
1212
concurrency:
13-
# The concurrency group contains the workflow name and the branch name for pull requests
14-
# or the commit hash for any other events.
15-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
16-
cancel-in-progress: true
13+
# The concurrency group contains the workflow name and the branch name for pull requests
14+
# or the commit hash for any other events.
15+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
16+
cancel-in-progress: true
1717

1818
jobs:
19-
compute-previous-wordpress-version:
20-
name: Compute previous WordPress version
21-
runs-on: ubuntu-latest
22-
outputs:
23-
previous-wordpress-version: ${{ steps.get-previous-wordpress-version.outputs.previous-wordpress-version }}
24-
latest-wordpress-version: ${{ steps.get-latest-wordpress-version.outputs.latest-wordpress-version }}
19+
test-php:
20+
name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 20
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
php:
27+
- '8.1'
28+
- '8.2'
29+
- '8.3'
30+
- '8.4'
31+
wordpress:
32+
- '6.5'
33+
- '6.7'
34+
- '6.8'
2535

26-
steps:
27-
- name: Get latest WordPress version
28-
id: get-latest-wordpress-version
29-
run: |
30-
curl \
31-
-H "Accept: application/json" \
32-
-o versions.json \
33-
"http://api.wordpress.org/core/stable-check/1.0/"
34-
LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
35-
echo "latest-wordpress-version=${LATEST_WP_VERSION}" >> $GITHUB_OUTPUT
36-
rm versions.json
37-
- name: Get previous WordPress version
38-
id: get-previous-wordpress-version
39-
run: |
40-
curl \
41-
-H "Accept: application/json" \
42-
-o versions.json \
43-
"http://api.wordpress.org/core/stable-check/1.0/"
44-
LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
45-
IFS='.' read LATEST_WP_MAJOR LATEST_WP_MINOR LATEST_WP_PATCH <<< "${LATEST_WP_VERSION}"
46-
if [[ ${LATEST_WP_MINOR} == "0" ]]; then
47-
PREVIOUS_WP_SERIES="$((LATEST_WP_MAJOR - 1)).9"
48-
else
49-
PREVIOUS_WP_SERIES="${LATEST_WP_MAJOR}.$((LATEST_WP_MINOR - 1))"
50-
fi
51-
PREVIOUS_WP_VERSION=$(jq --raw-output --arg series "${PREVIOUS_WP_SERIES}" 'with_entries(select(.key|startswith($series)))|keys[-1]' versions.json)
52-
echo "previous-wordpress-version=${PREVIOUS_WP_VERSION}" >> $GITHUB_OUTPUT
53-
rm versions.json
36+
env:
37+
WP_ENV_PHP_VERSION: ${{ matrix.php }}
38+
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
5439

55-
test-php:
56-
name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
57-
needs: compute-previous-wordpress-version
58-
runs-on: ubuntu-latest
59-
timeout-minutes: 20
60-
strategy:
61-
fail-fast: false
62-
matrix:
63-
php:
64-
- '7.0'
65-
- '7.1'
66-
- '7.2'
67-
- '7.3'
68-
- '7.4'
69-
- '8.0'
70-
- '8.1'
71-
- '8.2'
72-
wordpress: ["${{needs.compute-previous-wordpress-version.outputs.latest-wordpress-version}}" ] # Latest WordPress version.
73-
include:
74-
# Test with the previous WP version.
75-
- php: '7.0'
76-
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
77-
- php: '7.4'
78-
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
79-
- php: '8.2'
80-
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
81-
# Test with the upcoming WP version.
82-
- php: '7.0'
83-
wordpress: ''
84-
- php: '7.4'
85-
wordpress: ''
86-
- php: '8.2'
87-
wordpress: ''
40+
steps:
41+
- uses: actions/[email protected]
8842

89-
env:
90-
WP_ENV_PHP_VERSION: ${{ matrix.php }}
91-
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
43+
- name: Install Dependencies
44+
run: npm ci
9245

93-
steps:
94-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
46+
- name: Docker debug information
47+
run: |
48+
docker -v
49+
docker-compose -v
9550
96-
- name: Install Dependencies
97-
run: npm ci
51+
- name: General debug information
52+
run: |
53+
npm --version
54+
node --version
55+
curl --version
56+
git --version
57+
locale -a
58+
echo "PHP version: ${WP_ENV_PHP_VERSION}"
59+
echo "WordPress version: ${WP_ENV_CORE}"
9860
99-
- name: Docker debug information
100-
run: |
101-
docker -v
102-
docker-compose -v
61+
- name: Start Docker environment
62+
run: npm run wp-env start
10363

104-
- name: General debug information
105-
run: |
106-
npm --version
107-
node --version
108-
curl --version
109-
git --version
110-
locale -a
111-
echo "PHP version: ${WP_ENV_PHP_VERSION}"
112-
echo "WordPress version: ${WP_ENV_CORE}"
64+
- name: Log running Docker containers
65+
run: docker ps -a
11366

114-
- name: Start Docker environment
115-
run: npm run wp-env start
116-
117-
- name: Log running Docker containers
118-
run: docker ps -a
119-
120-
- name: Running unit tests
121-
run: |
122-
set -o pipefail
123-
npm run test:php
67+
- name: Running unit tests
68+
run: |
69+
set -o pipefail
70+
npm run test:php

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,15 @@ dwsync.xml
3131
.komodotools
3232

3333
# PHPUnit
34-
phpunit.xml
3534
phpunit.env
3635
.phpunit.result.cache
3736

38-
# PHPCS
39-
phpcs.xml
40-
41-
# Composer
42-
composer.lock
43-
4437
# Folders to ignore
4538
.hg
4639
.svn
4740
.CVS
4841
intermediate
4942
.idea
5043
cache
51-
deploy.sh
52-
node_modules
44+
node_modules
45+
vendor

.travis.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.wp-env.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
{
22
"core": "WordPress/WordPress",
33
"plugins": [ "." ],
4+
"config": {
5+
"WP_ENVIRONMENT_TYPE": "production",
6+
"WP_ENV": "production",
7+
"WP_DEBUG": true,
8+
"WP_DEBUG_LOG": true,
9+
"WP_DEBUG_DISPLAY": true
10+
},
411
"env": {
512
"tests": {
613
"mappings": {
7-
"wp-content/plugins/rollbar": "."
14+
"wp-content/plugins/rollbar": "./"
815
}
916
}
1017
}

bin/update-composer-dependencies.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

phpcs.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="WordPress Coding Standards for Plugins">
3+
<description>Generally-applicable sniffs for WordPress plugins</description>
4+
5+
<!-- <rule ref="WordPress-Core">-->
6+
<!-- <exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>-->
7+
<!-- </rule>-->
8+
<!-- <rule ref="WordPress-Docs"/>-->
9+
<rule ref="PSR12"/>
10+
11+
<!-- Check all PHP files. -->
12+
<arg name="extensions" value="php"/>
13+
<file>./mu-plugin</file>
14+
<file>./src</file>
15+
<file>./tests</file>
16+
<file>./rollbar.php</file>
17+
18+
<!-- Show sniff codes in all reports -->
19+
<arg value="s"/>
20+
21+
<exclude-pattern>*/node_modules/*</exclude-pattern>
22+
<exclude-pattern>*/vendor/*</exclude-pattern>
23+
24+
<!-- Custom rules. -->
25+
<rule ref="Generic.WhiteSpace.ScopeIndent">
26+
<properties>
27+
<property name="indent" value="4"/>
28+
<property name="tabIndent" value="false"/>
29+
</properties>
30+
</rule>
31+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
32+
</ruleset>

phpcs.xml.dist

Lines changed: 0 additions & 17 deletions
This file was deleted.

phpunit.env.dist

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)