Skip to content

Commit 74316c4

Browse files
stepankuzmingithub-actions[bot]
authored andcommitted
Test npm tarball in integration tests
GitOrigin-RevId: 5ca81f417a8aa5732cc4394a530066b20b80cf0a
1 parent 319ec8b commit 74316c4

File tree

16 files changed

+104
-59
lines changed

16 files changed

+104
-59
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,25 @@ jobs:
4444
cache-dependency-path: 'package-lock.json'
4545
- run: npm ci --no-audit --no-fund
4646
- run: npx playwright install chromium --with-deps --no-shell
47+
- run: npm run build-token
4748
- run: npm run build-dev
4849
- run: npm run build-prod-min
4950
- run: npm run build-esm-prod-min
5051
- run: npm run build-style-spec
5152
- run: npm run build-csp
5253
- run: npm run build-css
5354
- run: npm run test-build
54-
- run: xvfb-run -a npm run test-csp
5555
- run: xvfb-run -a npm run test-esm
56-
- run: npm run build-token
56+
- run: xvfb-run -a npm run test-csp
57+
- run: npm run build-dts
5758
- run: npm run build -w vite-build-test
5859
- run: npm run build -w webpack-build-test
59-
- run: npm run size
60+
- run: npm run test -w typescript-build-test
6061
- run: npm run build-pmtiles
62+
- run: npm run size
6163
- run: npm run prepare-release-pages
6264
if: ${{ always() }}
6365

64-
test-typings:
65-
runs-on: ubuntu-latest
66-
steps:
67-
- uses: actions/checkout@v4
68-
- uses: actions/setup-node@v4
69-
with:
70-
cache: npm
71-
node-version-file: '.nvmrc'
72-
cache-dependency-path: 'package-lock.json'
73-
- run: npm ci --no-audit --no-fund
74-
- run: npm test --workspace test/build/typings
75-
7666
test-unit:
7767
runs-on: ubuntu-latest
7868
timeout-minutes: 5
@@ -97,7 +87,6 @@ jobs:
9787
needs: [
9888
check,
9989
test-build,
100-
test-typings,
10190
test-unit
10291
]
10392
steps:
@@ -127,6 +116,5 @@ jobs:
127116
|-----|--------|
128117
| check | $(status_emoji "${{ needs.check.result }}") |
129118
| test-build | $(status_emoji "${{ needs.test-build.result }}") |
130-
| test-typings | $(status_emoji "${{ needs.test-typings.result }}") |
131119
| test-unit | $(status_emoji "${{ needs.test-unit.result }}") |
132120
EOF

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ tests-to-run.txt
3535
**/test/integration/dist/**/*.json
3636
**/test/build/vite/dist/dist/*
3737
**/test/build/webpack/dist/*
38+
test/build/*.tgz
3839
.eslintcache
3940
src/style-spec/dist/index.cjs
4041
src/style-spec/dist/index.d.ts

package-lock.json

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/build/pack.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -e
3+
4+
DEST="$(cd "$(dirname "$0")" && pwd)"
5+
cd "$DEST/../.."
6+
7+
if [ ! -f dist/mapbox-gl.js ] || [ ! -d dist/esm ] || [ ! -d dist/style-spec ]; then
8+
echo "pack.sh: dist/ artifacts missing. Run build-dev, build-prod, build-esm-prod, build-csp, build-css, build-style-spec, build-dts first." >&2
9+
exit 1
10+
fi
11+
12+
if [ -f "$DEST/mapbox-gl.tgz" ] && [ -f "$DEST/mapbox-gl-style-spec.tgz" ] \
13+
&& [ "$DEST/mapbox-gl.tgz" -nt dist/mapbox-gl.js ] \
14+
&& [ "$DEST/mapbox-gl-style-spec.tgz" -nt dist/style-spec/index.cjs ]; then
15+
exit 0
16+
fi
17+
18+
rm -f "$DEST"/mapbox-gl-*.tgz "$DEST"/mapbox-mapbox-gl-style-spec-*.tgz
19+
20+
npm pack --pack-destination "$DEST"
21+
npm pack --pack-destination "$DEST" --workspace src/style-spec
22+
23+
mv -f "$DEST"/mapbox-gl-[0-9]*.tgz "$DEST/mapbox-gl.tgz"
24+
mv -f "$DEST"/mapbox-mapbox-gl-style-spec-*.tgz "$DEST/mapbox-gl-style-spec.tgz"

test/build/typings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "mapbox-gl-ts",
2+
"name": "typescript-build-test",
33
"scripts": {
44
"pretest": "./pretest.sh",
55
"tsc": "tsc --project tsconfig.json",

test/build/typings/pretest.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
#!/bin/bash
2-
32
set -e
43

5-
pushd ../../../
6-
npm run build-dts
7-
npm run build-style-spec
8-
9-
npm pack --pack-destination test/build/typings
10-
npm pack --pack-destination test/build/typings --workspace src/style-spec
11-
12-
popd
13-
mv mapbox-gl-*.tgz mapbox-gl.tgz
14-
mv mapbox-mapbox-gl-style-spec-*.tgz mapbox-gl-style-spec.tgz
15-
16-
npm install --no-save mapbox-gl.tgz mapbox-gl-style-spec.tgz
17-
rm *.tgz
4+
../pack.sh
5+
rm -rf node_modules/mapbox-gl node_modules/@mapbox/mapbox-gl-style-spec
6+
npm install --no-save ../mapbox-gl.tgz ../mapbox-gl-style-spec.tgz

test/build/vite/esm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import mapbox from 'mapbox-gl/dist/esm/mapbox-gl.js';
2-
import 'mapbox-gl/dist/mapbox-gl.css';
1+
import mapbox from 'mapbox-gl/esm';
2+
import 'mapbox-gl/mapbox-gl.css';
33

44
mapbox.accessToken = import.meta.env.VITE_MAPBOX_ACCESS_TOKEN;
55

test/build/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7+
"prebuild": "./pretest.sh",
78
"dev": "vite",
89
"build": "vite build",
910
"preview": "vite preview"
1011
},
1112
"devDependencies": {
12-
"mapbox-gl": "file:../../../",
1313
"vite": "^8.0.8"
1414
}
1515
}

test/build/vite/pretest.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
4+
../pack.sh
5+
rm -rf node_modules/mapbox-gl
6+
npm install --no-save ../mapbox-gl.tgz
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable */
22

3-
import mapboxgl from '../../../dist/mapbox-gl-csp.js';
4-
import MapboxGLWorker from '../../../dist/mapbox-gl-csp-worker.js';
3+
import mapboxgl from 'mapbox-gl/dist/mapbox-gl-csp.js';
4+
import MapboxGLWorker from 'mapbox-gl/dist/mapbox-gl-csp-worker.js';
55

66
mapboxgl.accessToken = window.prompt("Enter access token");
77
mapboxgl.workerClass = MapboxGLWorker;

0 commit comments

Comments
 (0)