newspack-scripts 5.3.0 → 5.4.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 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.0",
3
+ "version": "5.4.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"
@@ -87,24 +87,32 @@ const getConfig = ({ gitBranchName }) => {
87
87
  ]);
88
88
 
89
89
  // Unless on a hotfix or epic branch, add a commit that updates the files.
90
- if (gitBranchName.indexOf("hotfix/") !== 0 && gitBranchName.indexOf("epic/") !== 0) {
91
- utils.log(`Plugin files and the changelog will be updated.`);
92
- config.prepare.push({
93
- path: "@semantic-release/git",
94
- // These assets should be added to source control after a release.
95
- assets: [
90
+ const branchType = gitBranchName.split("/")[0];
91
+ if (["hotfix", "epic"].indexOf(branchType) === -1) {
92
+ let assets = filesList;
93
+ // These assets should be added to source control after a release.
94
+ if (branchType === "release") {
95
+ assets = [
96
96
  ...filesList,
97
97
  "package.json",
98
98
  "package-lock.json",
99
99
  "CHANGELOG.md",
100
- ],
100
+ ];
101
+ }
102
+ utils.log(
103
+ `On ${branchType} branch, following files will be updated: ${assets.join(
104
+ ", "
105
+ )}`
106
+ );
107
+ config.prepare.push({
108
+ path: "@semantic-release/git",
109
+ assets,
101
110
  message:
102
111
  "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
103
112
  });
104
113
  } else {
105
- const branchType = gitBranchName.indexOf("hotfix/") === 0 ? 'hotfix' : 'epic';
106
114
  utils.log(
107
- `This is a ${branchType} branch, plugin files and the changelog will *not* be updated.`
115
+ `This branch is ${branchType}, plugin files and the changelog will *not* be updated.`
108
116
  );
109
117
  }
110
118
 
@@ -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
- ./vendor/bin/phpunit
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