Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add smoke-test that will use current npm source to overwrite itself #6491

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ jobs:
check_id: ${{ steps.check.outputs.check_id }}

smoke-publish:
# This cant be tested on Windows because our node_modules directory
# checks in symlinks which are not supported there. This should be
# fixed somehow, because this means some forms of local development
# are likely broken on Windows as well.
name: Smoke Publish - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
if: github.repository_owner == 'npm'
strategy:
Expand Down Expand Up @@ -288,12 +292,20 @@ jobs:
NPM_VERSION="$(node . --version)-$GITHUB_SHA.0"
node . version $NPM_VERSION --ignore-scripts
node scripts/publish.js --pack-destination=$RUNNER_TEMP
node . install --global $RUNNER_TEMP/npm-$NPM_VERSION.tgz
export SMOKE_PUBLISH_TARBALL="$RUNNER_TEMP/npm-$NPM_VERSION.tgz"
node . install --global $SMOKE_PUBLISH_TARBALL
node . install -w smoke-tests --ignore-scripts --no-audit --no-fund
node scripts/remove-files.js
# call installed npm instead of local source since we are testing
# the packed tarball that we just installed globally
npm test -w smoke-tests --ignore-scripts
NPM_GLOBAL_VERSION="$(npm --version)"
npm help
if [ "$NPM_GLOBAL_VERSION" == "$NPM_VERSION" ]; then
npm test -w smoke-tests --ignore-scripts
else
echo "global npm is not the correct version for smoke-publish"
echo "found: $NPM_GLOBAL_VERSION, expected: $NPM_VERSION"
exit 1
fi
- name: Conclude Check
uses: LouisBrunner/[email protected]
if: steps.check.outputs.check_id && always()
Expand Down
2 changes: 0 additions & 2 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,6 @@ graph LR;
npmcli-run-script-->read-package-json-fast;
npmcli-run-script-->which;
npmcli-smoke-tests-->http-proxy;
npmcli-smoke-tests-->just-extend;
npmcli-smoke-tests-->just-safe-set;
npmcli-smoke-tests-->npmcli-eslint-config["@npmcli/eslint-config"];
npmcli-smoke-tests-->npmcli-mock-registry["@npmcli/mock-registry"];
npmcli-smoke-tests-->npmcli-promise-spawn["@npmcli/promise-spawn"];
Expand Down
2 changes: 0 additions & 2 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -15506,8 +15506,6 @@
"@npmcli/promise-spawn": "^6.0.2",
"@npmcli/template-oss": "4.14.1",
"http-proxy": "^1.18.1",
"just-extend": "^6.2.0",
"just-safe-set": "^4.2.1",
"tap": "^16.3.4",
"which": "^3.0.0"
},
Expand Down
11 changes: 0 additions & 11 deletions scripts/remove-files.js

This file was deleted.

18 changes: 15 additions & 3 deletions scripts/template-oss/ci-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{> ciRelease}}

smoke-publish:
# This cant be tested on Windows because our node_modules directory
# checks in symlinks which are not supported there. This should be
# fixed somehow, because this means some forms of local development
# are likely broken on Windows as well.
{{> jobMatrix
jobName="Smoke Publish"
jobCheck=(obj sha="inputs.check-sha")
Expand All @@ -14,10 +18,18 @@
NPM_VERSION="$({{ rootNpmPath }} --version)-$GITHUB_SHA.0"
{{ rootNpmPath }} version $NPM_VERSION --ignore-scripts
node scripts/publish.js --pack-destination=$RUNNER_TEMP
{{ rootNpmPath }} install --global $RUNNER_TEMP/npm-$NPM_VERSION.tgz
export SMOKE_PUBLISH_TARBALL="$RUNNER_TEMP/npm-$NPM_VERSION.tgz"
{{ rootNpmPath }} install --global $SMOKE_PUBLISH_TARBALL
{{ rootNpmPath }} install -w smoke-tests --ignore-scripts --no-audit --no-fund
node scripts/remove-files.js
# call installed npm instead of local source since we are testing
# the packed tarball that we just installed globally
npm test -w smoke-tests --ignore-scripts
NPM_GLOBAL_VERSION="$(npm --version)"
npm help
if [ "$NPM_GLOBAL_VERSION" == "$NPM_VERSION" ]; then
npm test -w smoke-tests --ignore-scripts
else
echo "global npm is not the correct version for smoke-publish"
echo "found: $NPM_GLOBAL_VERSION, expected: $NPM_VERSION"
exit 1
fi
{{> stepChecks jobCheck=true }}
2 changes: 0 additions & 2 deletions smoke-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
"@npmcli/promise-spawn": "^6.0.2",
"@npmcli/template-oss": "4.14.1",
"http-proxy": "^1.18.1",
"just-extend": "^6.2.0",
"just-safe-set": "^4.2.1",
"tap": "^16.3.4",
"which": "^3.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/tap-snapshots/test/index.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ All commands:
whoami
Specify configs in the ini-formatted file:
{NPM}/{TESTDIR}/project/.npmrc
{NPM}/{TESTDIR}/home/.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Expand Down
Loading