Skip to content

Commit 863428f

Browse files
author
Guy Bedford
authored
include StarlingMonkey build for release (#815)
1 parent 266b618 commit 863428f

File tree

10 files changed

+157
-264
lines changed

10 files changed

+157
-264
lines changed

.github/workflows/main.yml

Lines changed: 129 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ jobs:
324324
test-npm-package:
325325
if: github.ref != 'refs/heads/main'
326326
runs-on: ubuntu-latest
327-
needs: [build]
327+
needs: [build, starlingmonkey-build]
328328
strategy:
329329
matrix:
330330
node-version: [18, 20]
@@ -338,6 +338,10 @@ jobs:
338338
uses: actions/download-artifact@v3
339339
with:
340340
name: engine-release
341+
- name: Download Engine
342+
uses: actions/download-artifact@v3
343+
with:
344+
name: starling-release
341345
- run: yarn
342346
shell: bash
343347
- run: npm test
@@ -356,3 +360,127 @@ jobs:
356360
fastly-api-token: ${{ secrets.FASTLY_API_TOKEN }}
357361
fastly-cli-version: ${{ env.fastly-cli_version }}
358362
github-token: ${{ secrets.GITHUB_TOKEN }}
363+
364+
starlingmonkey-build:
365+
name: StarlingMonkey Build
366+
runs-on: ubuntu-latest
367+
steps:
368+
- uses: actions/checkout@v3
369+
with:
370+
submodules: true
371+
- name: Install Rust 1.77.1
372+
run: |
373+
rustup toolchain install 1.77.1
374+
rustup target add wasm32-wasi --toolchain 1.77.1
375+
- name: Build
376+
run: npm run build:starlingmonkey
377+
- uses: actions/upload-artifact@v3
378+
with:
379+
name: starling-release
380+
path: starling.wasm
381+
382+
starlingmonkey-run_wpt:
383+
if: github.ref != 'refs/heads/main'
384+
name: Run Web Platform Tests
385+
needs: [starlingmonkey-build, ensure_cargo_installs]
386+
runs-on: ubuntu-latest
387+
steps:
388+
- uses: actions/checkout@v3
389+
with:
390+
submodules: true
391+
- uses: actions/setup-node@v3
392+
with:
393+
node-version: 20
394+
cache: 'yarn'
395+
396+
- name: Download Engine
397+
uses: actions/download-artifact@v3
398+
with:
399+
name: starling-release
400+
401+
- name: Restore Viceroy from cache
402+
uses: actions/cache@v3
403+
with:
404+
path: "/home/runner/.cargo/bin/viceroy"
405+
key: crate-cache-viceroy-${{ env.viceroy_version }}
406+
407+
- name: Restore wasm-tools from cache
408+
uses: actions/cache@v3
409+
id: wasm-tools
410+
with:
411+
path: "/home/runner/.cargo/bin/wasm-tools"
412+
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
413+
414+
- name: "Check wasm-tools has been restored"
415+
if: steps.wasm-tools.outputs.cache-hit != 'true'
416+
run: |
417+
echo "wasm-tools was not restored from the cache"
418+
echo "bailing out from the build early"
419+
exit 1
420+
421+
- run: yarn install --frozen-lockfile
422+
423+
- name: Build WPT runtime
424+
run: tests/wpt-harness/build-wpt-runtime.sh --starlingmonkey
425+
426+
- name: Prepare WPT hosts
427+
run: |
428+
cd tests/wpt-harness/wpt
429+
./wpt make-hosts-file | sudo tee -a /etc/hosts
430+
431+
- name: Run tests
432+
timeout-minutes: 20
433+
run: node ./tests/wpt-harness/run-wpt.mjs --starlingmonkey -vv
434+
435+
starlingmonkey-sdktest:
436+
if: github.ref != 'refs/heads/main'
437+
runs-on: ubuntu-latest
438+
strategy:
439+
matrix:
440+
platform: [viceroy, compute]
441+
needs: [starlingmonkey-build]
442+
steps:
443+
- name: Checkout fastly/js-compute-runtime
444+
uses: actions/checkout@v3
445+
- uses: actions/setup-node@v3
446+
with:
447+
node-version: 'lts/*'
448+
cache: 'yarn'
449+
450+
- name: Set up Fastly CLI
451+
uses: fastly/compute-actions/setup@v4
452+
with:
453+
token: ${{ secrets.GITHUB_TOKEN }}
454+
cli_version: ${{ env.fastly-cli_version }}
455+
456+
- name: Restore Viceroy from cache
457+
if: ${{ matrix.platform == 'viceroy' }}
458+
uses: actions/cache@v3
459+
id: viceroy
460+
with:
461+
path: "/home/runner/.cargo/bin/viceroy"
462+
key: crate-cache-viceroy-${{ env.viceroy_version }}
463+
464+
- name: Restore wasm-tools from cache
465+
uses: actions/cache@v3
466+
id: wasm-tools
467+
with:
468+
path: "/home/runner/.cargo/bin/wasm-tools"
469+
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
470+
471+
- name: "Check caches have been restored"
472+
if: steps.wasm-tools.outputs.cache-hit != 'true' || matrix.platform == 'viceory' && steps.viceroy.outputs.cache-hit != 'true'
473+
run: echo "Unable to restore from the cache, bailing." && exit 1
474+
475+
- name: Download Engine
476+
uses: actions/download-artifact@v3
477+
with:
478+
name: starling-release
479+
- run: yarn install --frozen-lockfile
480+
481+
- name: Yarn install
482+
run: yarn && cd ./integration-tests/js-compute && yarn
483+
484+
- run: node integration-tests/js-compute/test.js --starlingmonkey ${{ matrix.platform == 'viceroy' && '--local' || '' }}
485+
env:
486+
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}

.github/workflows/release-please.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ jobs:
149149

150150
- run: yarn build
151151

152+
- run: yarn build:starlingmonkey
153+
152154
- run: npm publish
153155
env:
154156
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/starlingmonkey.yml

Lines changed: 0 additions & 163 deletions
This file was deleted.

integration-tests/cli/component.test.js

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import test from 'brittle';
2+
import { getBinPath } from 'get-bin-path'
3+
import { prepareEnvironment } from '@jakechampion/cli-testing-library';
4+
5+
const cli = await getBinPath()
6+
7+
test('should create wasm file and return zero exit code for StarlingMonkey', async function (t) {
8+
const { execute, cleanup, writeFile, exists } = await prepareEnvironment();
9+
t.teardown(async function () {
10+
await cleanup();
11+
});
12+
13+
await writeFile('./bin/index.js', `addEventListener('fetch', function(){})`)
14+
15+
t.is(await exists('./bin/main.wasm'), false)
16+
17+
const { code, stdout, stderr } = await execute(process.execPath, cli + ' --starlingmonkey');
18+
19+
t.is(await exists('./bin/main.wasm'), true)
20+
t.alike(stdout, ['Building with the experimental StarlingMonkey engine']);
21+
t.alike(stderr, []);
22+
t.is(code, 0);
23+
});

0 commit comments

Comments
 (0)