newspack-scripts 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/package.json +10 -1
- package/scripts/release.js +20 -9
- package/src/jobs/test-php.yml +23 -2
package/README.md
CHANGED
|
@@ -196,6 +196,11 @@ circleci orb pack src/ > orb.yml && circleci orb publish orb.yml newspack/newspa
|
|
|
196
196
|
|
|
197
197
|
Note that before the first time updating you'll need to set the API key for CircleCI CLI by running `$ circleci setup`.
|
|
198
198
|
|
|
199
|
+
### Testing locally
|
|
200
|
+
|
|
201
|
+
1. Copy the path to this repository (e.g. `pwd | pbcopy`) and "install" it as an npm dependency in the repository on which you wish to test (e.g. `npm i /path/to/newspack-scripts`). You should end up with a `"newspack-scripts": "file:*"` entry in `package.json` instead of a version number.
|
|
202
|
+
2. Trigger a script and observe the results, e.g. `npm run semantic-release -- --dry-run`
|
|
203
|
+
|
|
199
204
|
---
|
|
200
205
|
|
|
201
206
|
## Misc
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newspack-scripts",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bin": {
|
|
6
6
|
"newspack-scripts": "./bin/newspack-scripts.js"
|
|
@@ -65,6 +65,15 @@
|
|
|
65
65
|
"scripts": {
|
|
66
66
|
"semantic-release": "semantic-release"
|
|
67
67
|
},
|
|
68
|
+
"release": {
|
|
69
|
+
"branches": [
|
|
70
|
+
"trunk",
|
|
71
|
+
{
|
|
72
|
+
"name": "alpha",
|
|
73
|
+
"prerelease": true
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
68
77
|
"repository": {
|
|
69
78
|
"type": "git",
|
|
70
79
|
"url": "https://github.com/Automattic/newspack-scripts.git"
|
package/scripts/release.js
CHANGED
|
@@ -21,6 +21,8 @@ if (shouldPublishOnNPM) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const getConfig = ({ gitBranchName }) => {
|
|
24
|
+
const branchType = gitBranchName.split("/")[0];
|
|
25
|
+
|
|
24
26
|
const config = {
|
|
25
27
|
dryRun: otherArgs.dryRun,
|
|
26
28
|
ci: otherArgs.ci,
|
|
@@ -71,6 +73,8 @@ const getConfig = ({ gitBranchName }) => {
|
|
|
71
73
|
label: `${process.env.CIRCLE_PROJECT_REPONAME}.zip`,
|
|
72
74
|
},
|
|
73
75
|
],
|
|
76
|
+
// Only post GH PR comments for alpha, hotfix/*, and release branches.
|
|
77
|
+
successComment: ["alpha", "hotfix", "release"].includes(branchType),
|
|
74
78
|
},
|
|
75
79
|
],
|
|
76
80
|
],
|
|
@@ -87,24 +91,31 @@ const getConfig = ({ gitBranchName }) => {
|
|
|
87
91
|
]);
|
|
88
92
|
|
|
89
93
|
// Unless on a hotfix or epic branch, add a commit that updates the files.
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
assets: [
|
|
94
|
+
if (["hotfix", "epic"].indexOf(branchType) === -1) {
|
|
95
|
+
let assets = filesList;
|
|
96
|
+
// These assets should be added to source control after a release.
|
|
97
|
+
if (branchType === "release") {
|
|
98
|
+
assets = [
|
|
96
99
|
...filesList,
|
|
97
100
|
"package.json",
|
|
98
101
|
"package-lock.json",
|
|
99
102
|
"CHANGELOG.md",
|
|
100
|
-
]
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
utils.log(
|
|
106
|
+
`On ${branchType} branch, following files will be updated: ${assets.join(
|
|
107
|
+
", "
|
|
108
|
+
)}`
|
|
109
|
+
);
|
|
110
|
+
config.prepare.push({
|
|
111
|
+
path: "@semantic-release/git",
|
|
112
|
+
assets,
|
|
101
113
|
message:
|
|
102
114
|
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
|
|
103
115
|
});
|
|
104
116
|
} else {
|
|
105
|
-
const branchType = gitBranchName.indexOf("hotfix/") === 0 ? 'hotfix' : 'epic';
|
|
106
117
|
utils.log(
|
|
107
|
-
`This is
|
|
118
|
+
`This branch is ${branchType}, plugin files and the changelog will *not* be updated.`
|
|
108
119
|
);
|
|
109
120
|
}
|
|
110
121
|
|
package/src/jobs/test-php.yml
CHANGED
|
@@ -20,9 +20,30 @@ steps:
|
|
|
20
20
|
command: |
|
|
21
21
|
sudo apt-get update && sudo apt-get install -y subversion default-mysql-client
|
|
22
22
|
- run:
|
|
23
|
-
name: Run Tests
|
|
23
|
+
name: Run Tests with Coverage
|
|
24
24
|
command: |
|
|
25
25
|
composer update
|
|
26
26
|
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
|
|
27
27
|
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest
|
|
28
|
-
|
|
28
|
+
# https://circleci.com/docs/code-coverage/#php
|
|
29
|
+
XDEBUG_MODE=coverage phpdbg -qrr vendor/bin/phpunit --coverage-clover coverage.xml
|
|
30
|
+
- run:
|
|
31
|
+
name: Upload Test Results to Codecov
|
|
32
|
+
command: |
|
|
33
|
+
if [[ -n $CODECOV_TOKEN ]]; then
|
|
34
|
+
# download Codecov CLI
|
|
35
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
36
|
+
|
|
37
|
+
# integrity check
|
|
38
|
+
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
|
|
39
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
40
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
|
|
41
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
|
|
42
|
+
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
|
|
43
|
+
|
|
44
|
+
shasum -a 256 -c codecov.SHA256SUM
|
|
45
|
+
sudo chmod +x codecov
|
|
46
|
+
./codecov upload-process -t $CODECOV_TOKEN
|
|
47
|
+
else
|
|
48
|
+
echo "CODECOV_TOKEN is not set. Skipping upload to Codecov."
|
|
49
|
+
fi
|