Skip to content

Commit c8144bc

Browse files
authored
Merge pull request #136 from Automattic/standardize/configs-and-ci
2 parents c4dfdf0 + 7800e73 commit c8144bc

File tree

7 files changed

+133
-38
lines changed

7 files changed

+133
-38
lines changed

.distignore

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
# Specify which files should not be included in the push to WordPress.org.
2-
# These are all development files and directories.
3-
# The deploy Action will use rsync + .distignore if the .distignore exists,
4-
# so it doesn't care what may or may not be ignored via .gitignore.
5-
1+
# Directories
62
/.git/
73
/.github/
84
/bin/
5+
/node_modules/
96
/tests/
10-
/.distignore
11-
/.editorconfig
12-
/.gitattributes
13-
/.gitignore
14-
/.phpcs.xml.dist
15-
/CHANGELOG.md
16-
/composer.json
17-
/mixtape.json
18-
/package.json
19-
/package-lock.json
20-
/phpunit.xml.dist
7+
/vendor/
8+
9+
# Files
10+
.distignore
11+
.editorconfig
12+
.gitattributes
13+
.gitignore
14+
.phpcs.xml.dist
15+
.wp-env.json
16+
.wp-env.override.json
17+
CHANGELOG.md
18+
composer.json
19+
composer.lock
20+
mixtape.json
21+
package.json
22+
package-lock.json
23+
phpunit.xml.dist

.github/dependabot.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Configuration for Dependabot version updates
2+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
interval: "weekly"
10+
day: "monday"
11+
groups:
12+
actions:
13+
patterns: ["*"]
14+
labels:
15+
- "dependencies"
16+
reviewers:
17+
- "Automattic/vip-plugins"
18+
commit-message:
19+
prefix: "Actions"
20+
include: "scope"
21+
open-pull-requests-limit: 5
22+
23+
- package-ecosystem: "composer"
24+
directory: "/"
25+
schedule:
26+
interval: "weekly"
27+
day: "tuesday"
28+
groups:
29+
dev-dependencies:
30+
patterns:
31+
- "automattic/*"
32+
- "dealerdirect/*"
33+
- "php-parallel-lint/*"
34+
- "phpcompatibility/*"
35+
- "phpunit/*"
36+
- "squizlabs/*"
37+
- "yoast/*"
38+
labels:
39+
- "dependencies"
40+
reviewers:
41+
- "Automattic/vip-plugins"
42+
commit-message:
43+
prefix: "Composer"
44+
include: "scope"
45+
open-pull-requests-limit: 5
46+
versioning-strategy: increase-if-necessary
47+
48+
- package-ecosystem: "npm"
49+
directory: "/"
50+
schedule:
51+
interval: "weekly"
52+
day: "wednesday"
53+
groups:
54+
dev-dependencies:
55+
patterns:
56+
- "@wordpress/*"
57+
- "eslint*"
58+
- "prettier*"
59+
- "@types/*"
60+
labels:
61+
- "dependencies"
62+
reviewers:
63+
- "Automattic/vip-plugins"
64+
commit-message:
65+
prefix: "npm"
66+
include: "scope"
67+
open-pull-requests-limit: 5

.github/workflows/cs-lint.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
# Allow manually triggering the workflow.
1111
workflow_dispatch:
1212

13+
permissions: {}
14+
1315
jobs:
1416
check_cs:
1517
name: "Basic CS and QA checks"
@@ -20,7 +22,7 @@ jobs:
2022

2123
steps:
2224
- name: Setup PHP
23-
uses: shivammathur/setup-php@v2
25+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
2426
with:
2527
php-version: "8.3"
2628
coverage: none
@@ -29,15 +31,17 @@ jobs:
2931
# Show PHP lint violations inline in the file diff.
3032
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
3133
- name: Register PHP lint violations to appear as file diff comments
32-
uses: korelstar/phplint-problem-matcher@v1
34+
uses: korelstar/phplint-problem-matcher@cb2b753750ec7bf13a7cde0a476df8c5605bdfb1 # v1.2.0
3335

3436
# Show XML violations inline in the file diff.
3537
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
3638
- name: Register XML violations to appear as file diff comments
37-
uses: korelstar/xmllint-problem-matcher@v1
39+
uses: korelstar/xmllint-problem-matcher@1bd292d642ddf3d369d02aaa8b262834d61198c0 # v1.2.0
3840

3941
- name: Checkout code
40-
uses: actions/checkout@v4
42+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
43+
with:
44+
persist-credentials: false
4145

4246
# Validate the composer.json file.
4347
# @link https://getcomposer.org/doc/03-cli.md#validate
@@ -47,7 +51,7 @@ jobs:
4751
# Install dependencies and handle caching in one go.
4852
# @link https://github.com/marketplace/actions/install-composer-dependencies
4953
- name: Install Composer dependencies
50-
uses: ramsey/composer-install@v3
54+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1
5155

5256
# Lint PHP.
5357
- name: Lint PHP against parse errors
@@ -56,7 +60,7 @@ jobs:
5660
# Needed as runs-on: system doesn't have xml-lint by default.
5761
# @link https://github.com/marketplace/actions/xml-lint
5862
- name: Lint phpunit.xml.dist
59-
uses: ChristophWurst/xmllint-action@v1
63+
uses: ChristophWurst/xmllint-action@7c54ff113fc0f6d4588a15cb4dfe31b6ecca5212 # v1.2.1
6064
with:
6165
xml-file: ./phpunit.xml.dist
6266
xml-schema-file: ./vendor/phpunit/phpunit/phpunit.xsd

.github/workflows/deploy.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,26 @@ on:
44
types: [ released ]
55
# Allow manual triggering of the workflow.
66
workflow_dispatch:
7+
8+
permissions: {}
9+
710
jobs:
811
release:
912
name: New release to WordPress.org
1013
runs-on: ubuntu-latest
1114
steps:
1215
- name: Checkout
13-
uses: actions/checkout@v4
16+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
17+
with:
18+
persist-credentials: false
1419

1520
- name: Install SVN (Subversion)
1621
run: |
1722
sudo apt-get update
1823
sudo apt-get install subversion
1924
2025
- name: Push to WordPress.org
21-
uses: 10up/action-wordpress-plugin-deploy@stable
26+
uses: 10up/action-wordpress-plugin-deploy@54bd289b8525fd23a5c365ec369185f2966529c2 # stable
2227
env:
2328
SLUG: zoninator
2429
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
paths-ignore:
77
- "**.md"
88

9+
permissions: {}
10+
911
jobs:
1012
test:
1113
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
@@ -39,35 +41,41 @@ jobs:
3941
steps:
4042

4143
- name: Checkout code
42-
uses: actions/checkout@v4
44+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
45+
with:
46+
persist-credentials: false
4347

4448
- name: Install wordpress environment
4549
run: npm install -g @wordpress/env
4650

4751
- name: Setup PHP ${{ matrix.php }}
48-
uses: shivammathur/setup-php@v2
52+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
4953
with:
5054
php-version: ${{ matrix.php }}
5155
tools: composer
5256

5357
- name: Install Composer dependencies
54-
uses: ramsey/composer-install@v3
58+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1
5559
with:
5660
composer-options: "${{ matrix.composer-options }}"
5761

5862
- name: Setup problem matchers for PHP
59-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
63+
run: echo "::add-matcher::${RUNNER_TOOL_CACHE}/php.json"
64+
env:
65+
RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}
6066

6167
- name: Setup Problem Matchers for PHPUnit
62-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
68+
run: echo "::add-matcher::${RUNNER_TOOL_CACHE}/phpunit.json"
69+
env:
70+
RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}
6371

6472
- name: Setup wp-env
6573
run: wp-env start
6674
env:
6775
WP_ENV_CORE: WordPress/WordPress#${{ matrix.wordpress }}
6876

6977
- name: Run integration tests (single site)
70-
run: composer test-integration
78+
run: composer test:integration
7179

7280
- name: Run integration tests (multisite)
73-
run: composer test-integration-ms
81+
run: composer test:integration-ms

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
/.phpunit.cache/
1+
# Dependencies
22
/node_modules/
33
/vendor/
4-
/.phpcs.xml
4+
5+
# Composer
56
/composer.lock
7+
8+
# Tests
9+
/.phpunit.cache/
10+
11+
# Local config overrides
12+
/.phpcs.xml
613
/phpcs.xml
714
/phpunit.xml
15+
/.wp-env.override.json

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"phpcompatibility/phpcompatibility-wp": "^2.1",
2525
"phpunit/phpunit": "^9",
2626
"rector/rector": "^1.2",
27-
"yoast/phpunit-polyfills": "^1"
27+
"yoast/wp-test-utils": "^1.2"
2828
},
2929
"config": {
3030
"allow-plugins": {
@@ -55,8 +55,8 @@
5555
"lint-ci": [
5656
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git --checkstyle"
5757
],
58-
"test-integration": "wp-env run tests-cli --env-cwd=wp-content/plugins/zoninator ./vendor/bin/phpunit --testsuite WP_Tests",
59-
"test-integration-ms": "wp-env run tests-cli --env-cwd=wp-content/plugins/zoninator /bin/bash -c 'WP_MULTISITE=1 ./vendor/bin/phpunit --testsuite WP_Tests'"
58+
"test:integration": "wp-env run tests-cli --env-cwd=wp-content/plugins/zoninator ./vendor/bin/phpunit --testsuite WP_Tests",
59+
"test:integration-ms": "wp-env run tests-cli --env-cwd=wp-content/plugins/zoninator /bin/bash -c 'WP_MULTISITE=1 ./vendor/bin/phpunit --testsuite WP_Tests'"
6060
},
6161
"scripts-descriptions": {
6262
"coverage": "Run tests with code coverage reporting",
@@ -66,7 +66,7 @@
6666
"i18n": "Generate a POT file for translation",
6767
"lint": "Run PHP linting",
6868
"lint-ci": "Run PHP linting and send results to stdout",
69-
"test-integration": "Run all integration tests for the Zoninator plugin",
70-
"test-integration-ms": "Run integration tests for the Zoninator plugin in multisite mode"
69+
"test:integration": "Run integration tests",
70+
"test:integration-ms": "Run integration tests in multisite mode"
7171
}
7272
}

0 commit comments

Comments
 (0)