Skip to content

Commit 2ffb130

Browse files
authored
Centralize npm run build job (microsoft#5776)
* Ignore *.tgz * Centralize npm run build * Fix dependencies * Use --call * Quote call command * Sort * Build browser matrix * Add extract tarballs * Build cldr-data
1 parent e5cc812 commit 2ffb130

File tree

25 files changed

+104
-23
lines changed

25 files changed

+104
-23
lines changed

.github/workflows/pull-request-validation.yml

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,28 @@ jobs:
8383
path: docker.zip
8484
retention-days: 1
8585

86+
- name: Pack all packages
87+
run: npm exec --workspaces -- npm pack
88+
89+
- name: Tar all tarballs
90+
run: find . -type f -name '*.tgz' -not -path '*/node_modules/*' -print0 | tar --null -cvf tarballs.tar --files-from=-
91+
92+
- uses: actions/upload-artifact@v7
93+
with:
94+
compression-level: 0
95+
name: tarballs
96+
path: tarballs.tar
97+
retention-days: 1
98+
8699
build-browser:
87-
name: Build test harness
88-
runs-on: windows-latest
100+
name: Verify build-browser
101+
strategy:
102+
matrix:
103+
os:
104+
- macos-latest
105+
- ubuntu-latest
106+
- windows-latest
107+
runs-on: ${{ matrix.os }}
89108

90109
steps:
91110
- uses: actions/checkout@v4
@@ -121,6 +140,8 @@ jobs:
121140

122141
static-code-analysis:
123142
name: Static code analysis
143+
needs:
144+
- build # Needed for resolving dependencies across packages
124145
runs-on: ubuntu-latest
125146

126147
steps:
@@ -134,12 +155,23 @@ jobs:
134155

135156
- run: npm clean-install --strict-peer-deps
136157

137-
- run: npm run build --if-present
158+
- name: Download tarballs
159+
uses: actions/download-artifact@v8
160+
with:
161+
name: tarballs
162+
163+
- name: Extract tarballs
164+
run: tar -xvf tarballs.tar
165+
166+
- name: Unpack tarballs
167+
run: npm exec --call 'tar --skip-old-files --strip-components=1 -xf *.tgz' --workspaces
138168

139169
- run: npm run precommit --if-present
140170

141171
unit-test:
142172
name: Unit test
173+
needs:
174+
- build
143175
runs-on: ubuntu-latest
144176

145177
steps:
@@ -153,7 +185,20 @@ jobs:
153185

154186
- run: npm clean-install --strict-peer-deps
155187

156-
- run: npm run build --if-present
188+
- name: Download tarballs
189+
uses: actions/download-artifact@v8
190+
with:
191+
name: tarballs
192+
193+
- name: Extract tarballs
194+
run: tar -xvf tarballs.tar
195+
196+
- name: Unpack tarballs
197+
run: npm exec --call 'tar --skip-old-files --strip-components=1 -xf *.tgz' --workspaces
198+
199+
- name: Build cldr-data # Required for unit testing
200+
run: npm run build
201+
working-directory: ./packages/support/cldr-data/
157202

158203
- name: Run jest --testPathPattern packages/
159204
run: |
@@ -187,6 +232,8 @@ jobs:
187232

188233
type-definitions-test:
189234
name: Type definitions test
235+
needs:
236+
- build
190237
runs-on: ubuntu-latest
191238

192239
steps:
@@ -200,7 +247,18 @@ jobs:
200247

201248
- run: npm clean-install --strict-peer-deps
202249

203-
- run: npm run build --if-present
250+
- name: Download tarballs
251+
uses: actions/download-artifact@v8
252+
with:
253+
name: tarballs
254+
255+
- name: Extract tarballs
256+
run: tar -xvf tarballs.tar
257+
258+
- name: Unpack tarballs
259+
run: npm exec --call 'tar --skip-old-files --strip-components=1 -xf *.tgz' --workspaces
260+
261+
# - run: npm run build --if-present
204262

205263
- name: Run tsd under packages/bundle (CJS)
206264
run: ../../node_modules/.bin/tsd -t ./dist/botframework-webchat.d.ts

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/__tests__/__image_snapshots__/**/__diff_output__
22
/__tests__/html2/**/*.snap-*-diff.png
33
/.env
4+
/*.tar
45
/*.tgz
56
/coverage
67
/debug.log
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
/dist
2-
/lib
3-
/node_modules
1+
/*.tgz
2+
/dist/
3+
/lib/
4+
/node_modules/
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
/dist
2-
/lib
3-
/node_modules
1+
/*.tgz
2+
/dist/
3+
/lib/
4+
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/*.tgz
12
/dist/
23
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/*.tgz
12
/dist/
23
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/*.tgz
12
/dist/
23
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/*.tgz
12
/dist/
23
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/*.tgz
12
/dist/
23
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/*.tgz
12
/dist/
23
/node_modules/

0 commit comments

Comments
 (0)