|
1 | | -# Ensures no accidential Node.js API usage in browser and Edge compatible entrypoints. |
| 1 | +# Ensures no accidential Node.js API usage in browser and Edge compatible |
| 2 | +# entrypoints, and that gRPC-only helpers stay isolated from the pb-free |
| 3 | +# entrypoints. The two `test-build:*` steps run in DIFFERENT environments: |
| 4 | +# 1. workers-safe: no @grpc/grpc-js, no @bufbuild/protobuf installed. |
| 5 | +# esbuild fails natively if any Workers-safe entry pulls them in. |
| 6 | +# Mirrors what a real Workers / REST-only consumer gets. |
| 7 | +# 2. grpc: pb + grpc-js reinstalled; the gRPC entrypoint must resolve. |
2 | 8 |
|
3 | 9 | name: Run Build Tests |
4 | 10 |
|
5 | 11 | on: |
6 | 12 | push: |
7 | | - branches: [ "main", "epic/**" ] |
| 13 | + branches: ['main', 'epic/**'] |
8 | 14 | pull_request: |
9 | | - branches: [ "main", "epic/**" ] |
| 15 | + branches: ['main', 'epic/**'] |
10 | 16 | paths-ignore: |
11 | 17 | - '**.md' |
12 | 18 | - 'LICENSE' |
|
15 | 21 |
|
16 | 22 | jobs: |
17 | 23 | test: |
18 | | - |
19 | 24 | runs-on: ubuntu-latest |
20 | 25 |
|
21 | 26 | steps: |
22 | | - - uses: actions/checkout@v4 |
23 | | - - uses: actions/setup-node@v4 |
24 | | - with: |
25 | | - node-version: 20 |
26 | | - registry-url: 'https://registry.npmjs.org' |
27 | | - cache: 'npm' |
28 | | - - run: npm ci |
29 | | - - run: npm run build |
30 | | - - run: npm run test-build |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: 20 |
| 31 | + registry-url: 'https://registry.npmjs.org' |
| 32 | + cache: 'npm' |
| 33 | + - run: npm ci |
| 34 | + - run: npm run build |
| 35 | + # Strip the optional peer deps so esbuild sees the same module graph |
| 36 | + # a non-gRPC consumer would. Any Workers-safe entrypoint that leaks |
| 37 | + # a gRPC / pb import fails to resolve here. |
| 38 | + - run: npm uninstall --no-save @grpc/grpc-js @bufbuild/protobuf |
| 39 | + - run: npm run test-build:workers-safe |
| 40 | + # Reinstall the peer deps and verify the gRPC entrypoint still bundles. |
| 41 | + - run: npm install --no-save @grpc/grpc-js @bufbuild/protobuf |
| 42 | + - run: npm run test-build:grpc |
0 commit comments