Skip to content

Commit a60b34e

Browse files
lukekarryswraithgar
authored andcommitted
chore: bail on docs building when smoke testing in incompatible versions
1 parent 3459567 commit a60b34e

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

.github/workflows/ci-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ jobs:
282282
- name: Reset Deps
283283
run: node . run resetdeps
284284
- name: Pack
285+
env:
286+
SMOKE_PUBLISH_NPM: 1
285287
run: |
286288
NPM_VERSION="$(node . --version)-$GITHUB_SHA.0"
287289
node . version $NPM_VERSION --ignore-scripts
@@ -291,7 +293,7 @@ jobs:
291293
node scripts/remove-files.js
292294
# call installed npm instead of local source since we are testing
293295
# the packed tarball that we just installed globally
294-
SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts
296+
npm test -w smoke-tests --ignore-scripts
295297
- name: Conclude Check
296298
uses: LouisBrunner/[email protected]
297299
if: steps.check.outputs.check_id && always()

DEPENDENCIES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ graph LR;
195195
npmcli-docs-->ignore-walk;
196196
npmcli-docs-->npmcli-eslint-config["@npmcli/eslint-config"];
197197
npmcli-docs-->npmcli-template-oss["@npmcli/template-oss"];
198+
npmcli-docs-->semver;
198199
npmcli-fs-->semver;
199200
npmcli-git-->npm-pick-manifest;
200201
npmcli-git-->npmcli-promise-spawn["@npmcli/promise-spawn"];
@@ -644,6 +645,7 @@ graph LR;
644645
npmcli-docs-->remark-man;
645646
npmcli-docs-->remark-parse;
646647
npmcli-docs-->remark-rehype;
648+
npmcli-docs-->semver;
647649
npmcli-docs-->tap;
648650
npmcli-docs-->unified;
649651
npmcli-docs-->yaml;

docs/bin/build.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
if (
2+
process.env.SMOKE_PUBLISH_NPM &&
3+
!require('semver').satisfies(process.version, require('../package.json').engines.node)
4+
) {
5+
// The docs tooling is kept in sync between releases and dependencies that are not compatible
6+
// with the lower bound of npm@8 engines are used. When we run the SMOKE_PUBLISH_NPM we are
7+
// testing that npm is able to pack and install itself locally and then run its own smoke tests.
8+
// Packing will run this script automatically so in the cases where the node version is
9+
// not compatible, it is ok to bail on this script since the generated docs are not used in
10+
// the smoke tests.
11+
console.log(`Skipping docs build due to SMOKE_PUBLISH_NPM and ${process.version}`)
12+
return
13+
}
14+
115
const run = require('../lib/build.js')
216
const { paths } = require('../lib/index')
317

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"remark-man": "^8.0.1",
3232
"remark-parse": "^10.0.1",
3333
"remark-rehype": "^10.1.0",
34+
"semver": "^7.3.8",
3435
"tap": "^16.3.4",
3536
"unified": "^10.1.2",
3637
"yaml": "^2.2.1"

package-lock.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
"remark-man": "^8.0.1",
192192
"remark-parse": "^10.0.1",
193193
"remark-rehype": "^10.1.0",
194+
"semver": "^7.3.8",
194195
"tap": "^16.3.4",
195196
"unified": "^10.1.2",
196197
"yaml": "^2.2.1"

scripts/template-oss/ci-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
windowsCI=false
99
}}
1010
- name: Pack
11+
env:
12+
SMOKE_PUBLISH_NPM: 1
1113
run: |
1214
NPM_VERSION="$({{ rootNpmPath }} --version)-$GITHUB_SHA.0"
1315
{{ rootNpmPath }} version $NPM_VERSION --ignore-scripts
@@ -17,5 +19,5 @@
1719
node scripts/remove-files.js
1820
# call installed npm instead of local source since we are testing
1921
# the packed tarball that we just installed globally
20-
SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts
22+
npm test -w smoke-tests --ignore-scripts
2123
{{> stepChecks jobCheck=true }}

0 commit comments

Comments
 (0)