Skip to content

Commit

Permalink
chore: bail on docs building when smoke testing in incompatible versions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored and wraithgar committed Feb 15, 2023
1 parent 3459567 commit a60b34e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions docs/bin/build.js
Original file line number Diff line number Diff line change
@@ -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')

Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion scripts/template-oss/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}

0 comments on commit a60b34e

Please sign in to comment.