Skip to content

Commit 61f00e3

Browse files
authored
chore: splits out smoke-tests from publish-dryrun tests (#8069)
This removes the `publish.sh --smoke-publish` like from the current `smoke-publish-test.sh` (renaming it to `smoke-test.sh`) and runs both operations as seperete jobs within the `ci.yml` (on pr) and `ci-release.yml` (on merge) workflow. Why? To avoid changed files / git dirty issues from one operation to the next. With this PR we should have the same checks that merge has, on pr as well, preventing scenarios where a PR breaks a `smoke test` or `publish --smoke-publish` test. The only difference between merge / pr is that merge has more tested node versions, if PRs start to pass but fail in these version lets add the full matrix. ```sh npm i npm@latest -g && node scripts/git-dirty.js && node scripts/resetdeps.js && ./scripts/smoke-tests.sh ``` ```sh npm i npm@latest -g && node scripts/git-dirty.js && node scripts/resetdeps.js && node ./scripts/publish.js --pack-destination=${pwd} --smoke-publish=true ```
1 parent 6d0f46e commit 61f00e3

File tree

6 files changed

+228
-40
lines changed

6 files changed

+228
-40
lines changed

.github/workflows/ci-release.yml

+70-9
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ jobs:
145145
conclusion: ${{ job.status }}
146146
check_id: ${{ steps.create-check.outputs.check-id }}
147147

148-
smoke-publish:
149-
# This cant be tested on Windows because our node_modules directory
150-
# checks in symlinks which are not supported there. This should be
151-
# fixed somehow, because this means some forms of local development
152-
# are likely broken on Windows as well.
153-
name: Smoke Publish - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
148+
smoke-tests:
149+
# This cant be tested on Windows because our node_modules directory
150+
# checks in symlinks which are not supported there. This should be
151+
# fixed somehow, because this means some forms of local development
152+
# are likely broken on Windows as well.
153+
name: Smoke Tests - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
154154
if: github.repository_owner == 'npm'
155155
strategy:
156156
fail-fast: false
@@ -182,7 +182,7 @@ jobs:
182182
if: ${{ inputs.check-sha }}
183183
uses: ./.github/actions/create-check
184184
with:
185-
name: "Smoke Publish - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
185+
name: "Smoke Tests - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
186186
token: ${{ secrets.GITHUB_TOKEN }}
187187
sha: ${{ inputs.check-sha }}
188188
- name: Setup Node
@@ -196,8 +196,69 @@ jobs:
196196
run: node scripts/git-dirty.js
197197
- name: Reset Deps
198198
run: node scripts/resetdeps.js
199-
- name: Smoke Publish
200-
run: ./scripts/smoke-publish-test.sh
199+
- name: Smoke Tests
200+
run: ./scripts/smoke-tests.sh
201+
- name: Conclude Check
202+
uses: LouisBrunner/[email protected]
203+
if: steps.create-check.outputs.check-id && always()
204+
with:
205+
token: ${{ secrets.GITHUB_TOKEN }}
206+
conclusion: ${{ job.status }}
207+
check_id: ${{ steps.create-check.outputs.check-id }}
208+
209+
publish-dryrun:
210+
# This cant be tested on Windows because our node_modules directory
211+
# checks in symlinks which are not supported there. This should be
212+
# fixed somehow, because this means some forms of local development
213+
# are likely broken on Windows as well.
214+
name: Publish Dry-Run - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
215+
if: github.repository_owner == 'npm'
216+
strategy:
217+
fail-fast: false
218+
matrix:
219+
platform:
220+
- name: Linux
221+
os: ubuntu-latest
222+
shell: bash
223+
node-version:
224+
- 20.17.0
225+
- 20.x
226+
- 22.9.0
227+
- 22.x
228+
runs-on: ${{ matrix.platform.os }}
229+
defaults:
230+
run:
231+
shell: ${{ matrix.platform.shell }}
232+
steps:
233+
- name: Checkout
234+
uses: actions/checkout@v4
235+
with:
236+
ref: ${{ inputs.ref }}
237+
- name: Setup Git User
238+
run: |
239+
git config --global user.email "[email protected]"
240+
git config --global user.name "npm CLI robot"
241+
- name: Create Check
242+
id: create-check
243+
if: ${{ inputs.check-sha }}
244+
uses: ./.github/actions/create-check
245+
with:
246+
name: "Publish Dry-Run - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
247+
token: ${{ secrets.GITHUB_TOKEN }}
248+
sha: ${{ inputs.check-sha }}
249+
- name: Setup Node
250+
uses: actions/setup-node@v4
251+
id: node
252+
with:
253+
node-version: ${{ matrix.node-version }}
254+
check-latest: contains(matrix.node-version, '.x')
255+
cache: npm
256+
- name: Check Git Status
257+
run: node scripts/git-dirty.js
258+
- name: Reset Deps
259+
run: node scripts/resetdeps.js
260+
- name: Publish Dry-Run
261+
run: node ./scripts/publish.js --pack-destination=$RUNNER_TEMP --smoke-publish=true
201262
- name: Conclude Check
202263
uses: LouisBrunner/[email protected]
203264
if: steps.create-check.outputs.check-id && always()

.github/workflows/ci.yml

+70-2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ jobs:
147147
run: node . run licenses
148148

149149
smoke-tests:
150+
# This cant be tested on Windows because our node_modules directory
151+
# checks in symlinks which are not supported there. This should be
152+
# fixed somehow, because this means some forms of local development
153+
# are likely broken on Windows as well.
150154
name: Smoke Tests
151155
if: github.repository_owner == 'npm'
152156
runs-on: ubuntu-latest
@@ -156,10 +160,20 @@ jobs:
156160
steps:
157161
- name: Checkout
158162
uses: actions/checkout@v4
163+
with:
164+
ref: ${{ inputs.ref }}
159165
- name: Setup Git User
160166
run: |
161167
git config --global user.email "[email protected]"
162168
git config --global user.name "npm CLI robot"
169+
- name: Create Check
170+
id: create-check
171+
if: ${{ inputs.check-sha }}
172+
uses: ./.github/actions/create-check
173+
with:
174+
name: "Smoke Tests"
175+
token: ${{ secrets.GITHUB_TOKEN }}
176+
sha: ${{ inputs.check-sha }}
163177
- name: Setup Node
164178
uses: actions/setup-node@v4
165179
id: node
@@ -171,10 +185,64 @@ jobs:
171185
run: node scripts/git-dirty.js
172186
- name: Reset Deps
173187
run: node scripts/resetdeps.js
174-
- name: Run Smoke Tests
175-
run: node . test -w smoke-tests --ignore-scripts
188+
- name: Smoke Tests
189+
run: ./scripts/smoke-tests.sh
190+
- name: Conclude Check
191+
uses: LouisBrunner/[email protected]
192+
if: steps.create-check.outputs.check-id && always()
193+
with:
194+
token: ${{ secrets.GITHUB_TOKEN }}
195+
conclusion: ${{ job.status }}
196+
check_id: ${{ steps.create-check.outputs.check-id }}
197+
198+
publish-dryrun:
199+
# This cant be tested on Windows because our node_modules directory
200+
# checks in symlinks which are not supported there. This should be
201+
# fixed somehow, because this means some forms of local development
202+
# are likely broken on Windows as well.
203+
name: Publish Dry-Run
204+
if: github.repository_owner == 'npm'
205+
runs-on: ubuntu-latest
206+
defaults:
207+
run:
208+
shell: bash
209+
steps:
210+
- name: Checkout
211+
uses: actions/checkout@v4
212+
with:
213+
ref: ${{ inputs.ref }}
214+
- name: Setup Git User
215+
run: |
216+
git config --global user.email "[email protected]"
217+
git config --global user.name "npm CLI robot"
218+
- name: Create Check
219+
id: create-check
220+
if: ${{ inputs.check-sha }}
221+
uses: ./.github/actions/create-check
222+
with:
223+
name: "Publish Dry-Run"
224+
token: ${{ secrets.GITHUB_TOKEN }}
225+
sha: ${{ inputs.check-sha }}
226+
- name: Setup Node
227+
uses: actions/setup-node@v4
228+
id: node
229+
with:
230+
node-version: 22.x
231+
check-latest: contains('22.x', '.x')
232+
cache: npm
176233
- name: Check Git Status
177234
run: node scripts/git-dirty.js
235+
- name: Reset Deps
236+
run: node scripts/resetdeps.js
237+
- name: Publish Dry-Run
238+
run: node ./scripts/publish.js --pack-destination=$RUNNER_TEMP --smoke-publish=true
239+
- name: Conclude Check
240+
uses: LouisBrunner/[email protected]
241+
if: steps.create-check.outputs.check-id && always()
242+
with:
243+
token: ${{ secrets.GITHUB_TOKEN }}
244+
conclusion: ${{ job.status }}
245+
check_id: ${{ steps.create-check.outputs.check-id }}
178246

179247
windows-shims:
180248
name: Windows Shims Tests

scripts/smoke-tests.js

Whitespace-only changes.

scripts/smoke-publish-test.sh scripts/smoke-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fi
6666
# were publishing it to the registry. The only difference is in the
6767
# publish.js script which will only pack and not publish
6868
node . version $NPM_VERSION --ignore-scripts --git-tag-version="$IS_CI"
69-
node scripts/publish.js --pack-destination=$RUNNER_TEMP --smoke-publish=true
69+
node . pack . --pack-destination "$RUNNER_TEMP"
7070
NPM_TARBALL="$RUNNER_TEMP/npm-$NPM_VERSION.tgz"
7171
node . install --global $NPM_TARBALL
7272

+44-22
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,45 @@
1-
{{> ciReleaseYml }}
1+
{{> ciReleaseYml }}
22

3-
smoke-publish:
4-
# This cant be tested on Windows because our node_modules directory
5-
# checks in symlinks which are not supported there. This should be
6-
# fixed somehow, because this means some forms of local development
7-
# are likely broken on Windows as well.
8-
{{> jobMatrixYml
9-
jobName="Smoke Publish"
10-
jobCheckout=(obj ref="${{ inputs.ref }}")
11-
jobCreateCheck=(obj sha="${{ inputs.check-sha }}")
12-
windowsCI=false
13-
macCI=false
14-
}}
15-
- name: Smoke Publish
16-
run: ./scripts/smoke-publish-test.sh
17-
- name: Conclude Check
18-
uses: LouisBrunner/[email protected]
19-
if: steps.create-check.outputs.check-id && always()
20-
with:
21-
token: $\{{ secrets.GITHUB_TOKEN }}
22-
conclusion: $\{{ job.status }}
23-
check_id: $\{{ steps.create-check.outputs.check-id }}
3+
smoke-tests:
4+
# This cant be tested on Windows because our node_modules directory
5+
# checks in symlinks which are not supported there. This should be
6+
# fixed somehow, because this means some forms of local development
7+
# are likely broken on Windows as well.
8+
{{> jobMatrixYml
9+
jobName="Smoke Tests"
10+
jobCheckout=(obj ref="${{ inputs.ref }}")
11+
jobCreateCheck=(obj sha="${{ inputs.check-sha }}")
12+
windowsCI=false
13+
macCI=false
14+
}}
15+
- name: Smoke Tests
16+
run: ./scripts/smoke-tests.sh
17+
- name: Conclude Check
18+
uses: LouisBrunner/[email protected]
19+
if: steps.create-check.outputs.check-id && always()
20+
with:
21+
token: $\{{ secrets.GITHUB_TOKEN }}
22+
conclusion: $\{{ job.status }}
23+
check_id: $\{{ steps.create-check.outputs.check-id }}
24+
25+
publish-dryrun:
26+
# This cant be tested on Windows because our node_modules directory
27+
# checks in symlinks which are not supported there. This should be
28+
# fixed somehow, because this means some forms of local development
29+
# are likely broken on Windows as well.
30+
{{> jobMatrixYml
31+
jobName="Publish Dry-Run"
32+
jobCheckout=(obj ref="${{ inputs.ref }}")
33+
jobCreateCheck=(obj sha="${{ inputs.check-sha }}")
34+
windowsCI=false
35+
macCI=false
36+
}}
37+
- name: Publish Dry-Run
38+
run: node ./scripts/publish.js --pack-destination=$RUNNER_TEMP --smoke-publish=true
39+
- name: Conclude Check
40+
uses: LouisBrunner/[email protected]
41+
if: steps.create-check.outputs.check-id && always()
42+
with:
43+
token: $\{{ secrets.GITHUB_TOKEN }}
44+
conclusion: $\{{ job.status }}
45+
check_id: $\{{ steps.create-check.outputs.check-id }}

scripts/template-oss/ci-yml.hbs

+43-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,49 @@
55
- name: Check Licenses
66
run: {{rootNpmPath}} run licenses
77

8-
smoke-tests:
9-
{{> jobYml jobName="Smoke Tests" }}
10-
- name: Run Smoke Tests
11-
run: {{rootNpmPath}} test -w smoke-tests --ignore-scripts
12-
- name: Check Git Status
13-
run: node scripts/git-dirty.js
8+
smoke-tests:
9+
# This cant be tested on Windows because our node_modules directory
10+
# checks in symlinks which are not supported there. This should be
11+
# fixed somehow, because this means some forms of local development
12+
# are likely broken on Windows as well.
13+
{{> jobYml
14+
jobName="Smoke Tests"
15+
jobCheckout=(obj ref="${{ inputs.ref }}")
16+
jobCreateCheck=(obj sha="${{ inputs.check-sha }}")
17+
windowsCI=false
18+
macCI=false
19+
}}
20+
- name: Smoke Tests
21+
run: ./scripts/smoke-tests.sh
22+
- name: Conclude Check
23+
uses: LouisBrunner/[email protected]
24+
if: steps.create-check.outputs.check-id && always()
25+
with:
26+
token: $\{{ secrets.GITHUB_TOKEN }}
27+
conclusion: $\{{ job.status }}
28+
check_id: $\{{ steps.create-check.outputs.check-id }}
29+
30+
publish-dryrun:
31+
# This cant be tested on Windows because our node_modules directory
32+
# checks in symlinks which are not supported there. This should be
33+
# fixed somehow, because this means some forms of local development
34+
# are likely broken on Windows as well.
35+
{{> jobYml
36+
jobName="Publish Dry-Run"
37+
jobCheckout=(obj ref="${{ inputs.ref }}")
38+
jobCreateCheck=(obj sha="${{ inputs.check-sha }}")
39+
windowsCI=false
40+
macCI=false
41+
}}
42+
- name: Publish Dry-Run
43+
run: node ./scripts/publish.js --pack-destination=$RUNNER_TEMP --smoke-publish=true
44+
- name: Conclude Check
45+
uses: LouisBrunner/[email protected]
46+
if: steps.create-check.outputs.check-id && always()
47+
with:
48+
token: $\{{ secrets.GITHUB_TOKEN }}
49+
conclusion: $\{{ job.status }}
50+
check_id: $\{{ steps.create-check.outputs.check-id }}
1451

1552
windows-shims:
1653
name: Windows Shims Tests

0 commit comments

Comments
 (0)