1717 NODE_VERSION : 24.12.0
1818 DENO_VERSION : 2.8.1
1919 BUN_VERSION : 1.3.14
20+ ORTOOLS_SERVER_IMAGE : ortools-wasm-native-server:ci
21+ ORTOOLS_WASM_SKIP_PACKAGE_BUILD : ' 1'
2022
2123jobs :
2224 package :
@@ -31,13 +33,15 @@ jobs:
3133 submodules : recursive
3234
3335 - name : Setup Node
36+ if : ${{ !env.ACT }}
3437 uses : actions/setup-node@v6
3538 with :
3639 node-version : ${{ env.NODE_VERSION }}
3740 cache : npm
3841 cache-dependency-path : package/package-lock.json
3942
4043 - name : Cache Emscripten and CMake build
44+ if : ${{ !env.ACT }}
4145 uses : actions/cache@v4
4246 with :
4347 path : |
@@ -52,18 +56,25 @@ jobs:
5256 wasm-build-${{ runner.os }}-
5357
5458 - name : Install dependencies
59+ if : ${{ !env.ACT }}
5560 run : npm ci --prefix package
5661
5762 - name : Install native build tools
63+ if : ${{ !env.ACT }}
5864 run : sudo apt-get update && sudo apt-get install -y cmake ninja-build
5965
6066 - name : Prepare package README for release tag
6167 if : ${{ startsWith(github.ref, 'refs/tags/v') }}
6268 run : node scripts/prepare_package_readme.mjs "$GITHUB_REF_NAME"
6369
6470 - name : Build and pack library
71+ if : ${{ !env.ACT }}
6572 run : npm --prefix package run pack:lib
6673
74+ - name : Require locally packed library
75+ if : ${{ env.ACT }}
76+ run : test -n "$(find package/build/javascript/lib -maxdepth 1 -name '*.tgz' -print -quit)"
77+
6778 - name : Upload package artifact
6879 if : ${{ !env.ACT }}
6980 uses : actions/upload-artifact@v7
@@ -125,7 +136,7 @@ jobs:
125136
126137 - name : Run Vite fixture
127138 working-directory : package
128- run : NODE_PATH=./node_modules FIXTURE_GROUP=vite npx playwright test --config ../ tests/playwright.config.ts --project=${{ matrix.project }}
139+ run : NODE_PATH=./node_modules FIXTURE_GROUP=vite npx playwright test --config tests/playwright.config.ts --project=${{ matrix.project }}
129140
130141 webpack-fixture :
131142 name : Webpack 5 / ${{ matrix.mode }} / ${{ matrix.browser }}
@@ -179,7 +190,7 @@ jobs:
179190
180191 - name : Run Webpack fixture
181192 working-directory : package
182- run : NODE_PATH=./node_modules FIXTURE_GROUP=webpack npx playwright test --config ../ tests/playwright.config.ts --project=${{ matrix.project }}
193+ run : NODE_PATH=./node_modules FIXTURE_GROUP=webpack npx playwright test --config tests/playwright.config.ts --project=${{ matrix.project }}
183194
184195 rollup-fixture :
185196 name : Rollup 4 / static / ${{ matrix.browser }}
@@ -225,7 +236,7 @@ jobs:
225236
226237 - name : Run Rollup fixture
227238 working-directory : package
228- run : NODE_PATH=./node_modules FIXTURE_GROUP=rollup npx playwright test --config ../ tests/playwright.config.ts --project=${{ matrix.project }}
239+ run : NODE_PATH=./node_modules FIXTURE_GROUP=rollup npx playwright test --config tests/playwright.config.ts --project=${{ matrix.project }}
229240
230241 deno-fixture :
231242 name : Deno 2.8.1 / solve
@@ -327,6 +338,87 @@ jobs:
327338 - name : Run Bun fixture
328339 run : npm --prefix package run test:fixture:bun
329340
341+ server-fixture :
342+ name : Native server / JavaScript client
343+ needs : package
344+ runs-on : ubuntu-24.04
345+ timeout-minutes : 90
346+
347+ steps :
348+ - name : Checkout
349+ uses : actions/checkout@v6
350+ with :
351+ submodules : recursive
352+
353+ - name : Setup Node
354+ uses : actions/setup-node@v6
355+ with :
356+ node-version : ${{ env.NODE_VERSION }}
357+ cache : npm
358+ cache-dependency-path : package/package-lock.json
359+
360+ - name : Install dependencies
361+ run : npm ci --prefix package
362+
363+ - name : Download package artifact
364+ if : ${{ !env.ACT }}
365+ uses : actions/download-artifact@v8
366+ with :
367+ name : npm-package
368+ path : package/build/javascript/lib
369+
370+ - name : Setup Docker Buildx
371+ if : ${{ !env.ACT }}
372+ uses : docker/setup-buildx-action@v3
373+
374+ - name : Build native server image
375+ if : ${{ !env.ACT }}
376+ uses : docker/build-push-action@v6
377+ with :
378+ context : .
379+ file : server/Dockerfile
380+ tags : ${{ env.ORTOOLS_SERVER_IMAGE }}
381+ load : true
382+ cache-from : type=gha,scope=native-server
383+ cache-to : type=gha,mode=max,scope=native-server
384+
385+ - name : Build native server image with local cache
386+ if : ${{ env.ACT }}
387+ run : docker build --file server/Dockerfile --tag "${ORTOOLS_SERVER_IMAGE}" .
388+
389+ - name : Start native server
390+ run : docker compose -f server/docker-compose.yml up -d --no-build ortools-native
391+
392+ - name : Require healthy native server
393+ run : |
394+ for attempt in $(seq 1 60); do
395+ if curl --fail --silent --show-error http://127.0.0.1:17827/healthz; then
396+ exit 0
397+ fi
398+ sleep 1
399+ done
400+ echo "Native server did not become healthy." >&2
401+ exit 1
402+
403+ - name : Build Vite fixture
404+ run : npm --prefix package run test:fixture:vite:build
405+
406+ - name : Install Chromium
407+ working-directory : package
408+ run : npx playwright install --with-deps chromium
409+
410+ - name : Run fixture against native server
411+ working-directory : package
412+ run : ORTOOLS_TEST_SERVER=1 NODE_PATH=./node_modules FIXTURE_GROUP=vite npx playwright test --config tests/playwright.config.ts --project=vite-static-chromium
413+
414+ - name : Show native server logs
415+ if : ${{ always() }}
416+ run : docker compose -f server/docker-compose.yml logs --no-color ortools-native
417+
418+ - name : Stop native server
419+ if : ${{ always() }}
420+ run : docker compose -f server/docker-compose.yml down --remove-orphans
421+
330422 publish :
331423 name : Publish release
332424 needs :
@@ -337,6 +429,7 @@ jobs:
337429 - deno-fixture
338430 - node-fixture
339431 - bun-fixture
432+ - server-fixture
340433 runs-on : ubuntu-24.04
341434 timeout-minutes : 10
342435 if : ${{ startsWith(github.ref, 'refs/tags/v') && github.actor != 'nektos/act' }}
0 commit comments