diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 10378175bb7d3..4abb5d80bf7ad 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -282,6 +282,8 @@ jobs: - name: Reset Deps run: node . run resetdeps - name: Pack + env: + SMOKE_PUBLISH_NPM: 1 run: | NPM_VERSION="$(node . --version)-$GITHUB_SHA.0" node . version $NPM_VERSION --ignore-scripts @@ -291,7 +293,7 @@ jobs: node scripts/remove-files.js # call installed npm instead of local source since we are testing # the packed tarball that we just installed globally - SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts + npm test -w smoke-tests --ignore-scripts - name: Conclude Check uses: LouisBrunner/checks-action@v1.3.1 if: steps.check.outputs.check_id && always() diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 5d1e94d496bef..c5d4291e4c14b 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -195,6 +195,7 @@ graph LR; npmcli-docs-->ignore-walk; npmcli-docs-->npmcli-eslint-config["@npmcli/eslint-config"]; npmcli-docs-->npmcli-template-oss["@npmcli/template-oss"]; + npmcli-docs-->semver; npmcli-fs-->semver; npmcli-git-->npm-pick-manifest; npmcli-git-->npmcli-promise-spawn["@npmcli/promise-spawn"]; @@ -644,6 +645,7 @@ graph LR; npmcli-docs-->remark-man; npmcli-docs-->remark-parse; npmcli-docs-->remark-rehype; + npmcli-docs-->semver; npmcli-docs-->tap; npmcli-docs-->unified; npmcli-docs-->yaml; diff --git a/docs/bin/build.js b/docs/bin/build.js index 6832274fde2e6..b94a85cf6f9bc 100644 --- a/docs/bin/build.js +++ b/docs/bin/build.js @@ -1,3 +1,17 @@ +if ( + process.env.SMOKE_PUBLISH_NPM && + !require('semver').satisfies(process.version, require('../package.json').engines.node) +) { + // The docs tooling is kept in sync between releases and dependencies that are not compatible + // with the lower bound of npm@8 engines are used. When we run the SMOKE_PUBLISH_NPM we are + // testing that npm is able to pack and install itself locally and then run its own smoke tests. + // Packing will run this script automatically so in the cases where the node version is + // not compatible, it is ok to bail on this script since the generated docs are not used in + // the smoke tests. + console.log(`Skipping docs build due to SMOKE_PUBLISH_NPM and ${process.version}`) + return +} + const run = require('../lib/build.js') const { paths } = require('../lib/index') diff --git a/docs/package.json b/docs/package.json index dda998e9e4b19..a1ea4711b6e84 100644 --- a/docs/package.json +++ b/docs/package.json @@ -31,6 +31,7 @@ "remark-man": "^8.0.1", "remark-parse": "^10.0.1", "remark-rehype": "^10.1.0", + "semver": "^7.3.8", "tap": "^16.3.4", "unified": "^10.1.2", "yaml": "^2.2.1" diff --git a/package-lock.json b/package-lock.json index e0651c48e665e..4cc9c0d86c4c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -191,6 +191,7 @@ "remark-man": "^8.0.1", "remark-parse": "^10.0.1", "remark-rehype": "^10.1.0", + "semver": "^7.3.8", "tap": "^16.3.4", "unified": "^10.1.2", "yaml": "^2.2.1" diff --git a/scripts/template-oss/ci-release.yml b/scripts/template-oss/ci-release.yml index 9482c31dec7b7..44b184db8ae81 100644 --- a/scripts/template-oss/ci-release.yml +++ b/scripts/template-oss/ci-release.yml @@ -8,6 +8,8 @@ windowsCI=false }} - name: Pack + env: + SMOKE_PUBLISH_NPM: 1 run: | NPM_VERSION="$({{ rootNpmPath }} --version)-$GITHUB_SHA.0" {{ rootNpmPath }} version $NPM_VERSION --ignore-scripts @@ -17,5 +19,5 @@ node scripts/remove-files.js # call installed npm instead of local source since we are testing # the packed tarball that we just installed globally - SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts + npm test -w smoke-tests --ignore-scripts {{> stepChecks jobCheck=true }}