feat: enable use of preexisting weval binary (#156) #477
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
defaults: | |
run: | |
shell: bash | |
# Cancel any in-flight jobs for the same PR/branch so there's only one active | |
# at a time | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rustup update stable | |
rustup default stable | |
rustup component add rustfmt | |
- name: Format source code | |
run: cargo fmt -- --check | |
######### | |
# Build # | |
######### | |
build-splicer: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- '22' | |
- latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
run: | | |
rustup toolchain install 1.77.1 | |
rustup target add wasm32-wasi --toolchain 1.77.1 | |
rustup target add wasm32-wasi | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Install NPM packages | |
run: npm install | |
- name: Cache Splicer build | |
uses: actions/cache@v4 | |
id: splicer-build | |
with: | |
key: output-splicer-node-${{matrix.node-version}}-${{ hashFiles('Cargo.lock', 'crates/spidermonkey-embedding-splicer/src/**/*.rs') }} | |
path: | | |
lib/spidermonkey-embedding-splicer.core2.wasm | |
lib/spidermonkey-embedding-splicer.core.wasm | |
lib/spidermonkey-embedding-splicer.d.ts | |
lib/spidermonkey-embedding-splicer.js | |
target | |
- name: Build splicer | |
if: steps.splicer-build.outputs.cache-hit != 'true' | |
run: | | |
make lib/spidermonkey-embedding-splicer.js | |
build-jit: | |
runs-on: ubuntu-latest | |
needs: | |
- build-splicer | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- '22' | |
- latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Get StarlingMonkey Commit | |
id: starlingmonkey-commit | |
run: echo "STARLINGMONKEY_HASH=$(git submodule status | head -c9 | tail -c8)" >> "$GITHUB_OUTPUT" | |
- name: Install Rust Toolchain | |
run: | | |
rustup toolchain install 1.77.1 | |
rustup target add wasm32-wasi --toolchain 1.77.1 | |
rustup target add wasm32-wasi | |
- name: Restore Embedding Splicer from cache | |
uses: actions/cache/restore@v4 | |
id: splicer-build | |
with: | |
key: output-splicer-node-${{matrix.node-version}}-${{ hashFiles('Cargo.lock', 'crates/spidermonkey-embedding-splicer/src/**/*.rs') }} | |
path: | | |
lib/spidermonkey-embedding-splicer.core2.wasm | |
lib/spidermonkey-embedding-splicer.core.wasm | |
lib/spidermonkey-embedding-splicer.d.ts | |
lib/spidermonkey-embedding-splicer.js | |
target | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Install NPM packages | |
run: npm install | |
- name: Cache StarlingMonkey | |
uses: actions/cache@v4 | |
id: starlingmonkey-jit | |
with: | |
key: output-starlingmonkey-jit-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
lookup-only: 'true' | |
path: | | |
lib/starlingmonkey_embedding.wasm | |
build-release | |
- name: Build ComponentizeJS | |
if: steps.starlingmonkey-jit.outputs.cache-hit != 'true' | |
run: | | |
npm run clean | |
npm run build | |
- uses: actions/upload-artifact@v4 | |
if: steps.starlingmonkey-jit.outputs.cache-hit != 'true' | |
with: | |
name: starlingmonkey-jit-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
if-no-files-found: 'error' | |
path: | | |
lib/starlingmonkey_embedding.wasm | |
build-release | |
build-aot: | |
runs-on: ubuntu-latest | |
needs: | |
- build-splicer | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- '22' | |
- latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Get StarlingMonkey Commit | |
id: starlingmonkey-commit | |
run: echo "STARLINGMONKEY_HASH=$(git submodule status | head -c9 | tail -c8)" >> "$GITHUB_OUTPUT" | |
- name: Install Rust Toolchain | |
run: | | |
rustup toolchain install 1.77.1 | |
rustup target add wasm32-wasi --toolchain 1.77.1 | |
rustup target add wasm32-wasi | |
- name: Restore Embedding Splicer from cache | |
uses: actions/cache/restore@v4 | |
id: splicer-build | |
with: | |
key: output-splicer-node-${{matrix.node-version}}-${{ hashFiles('Cargo.lock', 'crates/spidermonkey-embedding-splicer/src/**/*.rs') }} | |
path: | | |
lib/spidermonkey-embedding-splicer.core2.wasm | |
lib/spidermonkey-embedding-splicer.core.wasm | |
lib/spidermonkey-embedding-splicer.d.ts | |
lib/spidermonkey-embedding-splicer.js | |
target | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Install NPM packages | |
run: npm install | |
- name: Cache StarlingMonkey (Weval) | |
uses: actions/cache@v4 | |
id: starlingmonkey-aot | |
with: | |
key: output-starlingmonkey-aot-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
lookup-only: 'true' | |
path: | | |
lib/starlingmonkey_embedding_weval.wasm | |
lib/starlingmonkey_ics.wevalcache | |
build-release-weval | |
- name: Build Weval | |
if: steps.starlingmonkey-aot.outputs.cache-hit != 'true' | |
run: | | |
npm run clean | |
npm run build:weval | |
- uses: actions/upload-artifact@v4 | |
if: steps.starlingmonkey-aot.outputs.cache-hit != 'true' | |
with: | |
name: starlingmonkey-aot-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
if-no-files-found: 'error' | |
path: | | |
lib/starlingmonkey_embedding_weval.wasm | |
lib/starlingmonkey_ics.wevalcache | |
build-release-weval | |
######## | |
# Test # | |
######## | |
test-jit: | |
runs-on: ubuntu-latest | |
needs: | |
- build-jit | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- '22' | |
- latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get StarlingMonkey Commit | |
id: starlingmonkey-commit | |
run: echo "STARLINGMONKEY_HASH=$(git submodule status | head -c9 | tail -c8)" >> "$GITHUB_OUTPUT" | |
- name: Restore Embedding Splicer from cache | |
uses: actions/cache/restore@v4 | |
id: splicer-build | |
with: | |
key: output-splicer-node-${{matrix.node-version}}-${{ hashFiles('Cargo.lock', 'crates/spidermonkey-embedding-splicer/src/**/*.rs') }} | |
path: | | |
lib/spidermonkey-embedding-splicer.core2.wasm | |
lib/spidermonkey-embedding-splicer.core.wasm | |
lib/spidermonkey-embedding-splicer.d.ts | |
lib/spidermonkey-embedding-splicer.js | |
target | |
- name: Restore StarlingMonkey build from cache | |
uses: actions/cache/restore@v4 | |
id: restore-starlingmonkey-jit-build | |
with: | |
key: output-starlingmonkey-jit-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
path: | | |
lib/starlingmonkey_embedding.wasm | |
build-release | |
- uses: actions/download-artifact@v4 | |
if: steps.restore-starlingmonkey-jit-build.outputs.cache-hit != 'true' | |
with: | |
name: starlingmonkey-jit-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
path: | | |
lib/starlingmonkey_embedding.wasm | |
build-release | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Install NPM packages | |
run: npm install | |
- name: Test | |
run: npm run test | |
- name: Cache Example build | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # 4.1.2 | |
with: | |
path: example/target | |
key: output-example-jit-cargo-${{ hashFiles('example/src/main.rs', 'example/Cargo.lock', 'example/hello.wit') }} | |
- name: Test Example | |
run: cd example && npm run build && ./test.sh | |
test-aot: | |
runs-on: ubuntu-latest | |
needs: | |
- build-aot | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- '22' | |
- latest | |
env: | |
ENABLE_AOT: "1" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get StarlingMonkey Commit | |
id: starlingmonkey-commit | |
run: echo "STARLINGMONKEY_HASH=$(git submodule status | head -c9 | tail -c8)" >> "$GITHUB_OUTPUT" | |
- name: Restore Embedding Splicer from cache | |
uses: actions/cache/restore@v4 | |
id: splicer-build | |
with: | |
key: output-splicer-node-${{matrix.node-version}}-${{ hashFiles('Cargo.lock', 'crates/spidermonkey-embedding-splicer/src/**/*.rs') }} | |
path: | | |
lib/spidermonkey-embedding-splicer.core2.wasm | |
lib/spidermonkey-embedding-splicer.core.wasm | |
lib/spidermonkey-embedding-splicer.d.ts | |
lib/spidermonkey-embedding-splicer.js | |
target | |
- name: Restore StarlingMonkey AOT build from cache | |
uses: actions/cache/restore@v4 | |
id: restore-starlingmonkey-aot-build | |
with: | |
key: output-starlingmonkey-aot-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
path: | | |
lib/starlingmonkey_embedding_weval.wasm | |
lib/starlingmonkey_ics.wevalcache | |
build-release-weval | |
- uses: actions/download-artifact@v4 | |
if: steps.restore-starlingmonkey-aot-build.outputs.cache-hit != 'true' | |
with: | |
name: starlingmonkey-aot-node-${{matrix.node-version}}-${{ steps.starlingmonkey-commit.outputs.STARLINGMONKEY_HASH }} | |
path: | | |
lib/starlingmonkey_embedding_weval.wasm | |
lib/starlingmonkey_ics.wevalcache | |
build-release-weval | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Install NPM packages | |
run: npm install | |
- name: Test | |
run: npm run test:weval | |
- name: Cache Example build | |
uses: actions/cache@v4 | |
with: | |
path: example/target | |
key: output-example-aot-cargo-${{ hashFiles('example/src/main.rs', 'example/Cargo.lock', 'example/hello.wit') }} | |
- name: Test Example | |
run: cd example && npm run build && ./test.sh |