Skip to content

Complete StarlingMonkey SDK Tests #196

Complete StarlingMonkey SDK Tests

Complete StarlingMonkey SDK Tests #196

Workflow file for this run

name: StarlingMonkey
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow}}
cancel-in-progress: true
on:
pull_request:
push:
branches: [main]
defaults:
run:
shell: bash
env:
viceroy_version: 0.9.4
wasm-tools_version: 1.0.28
fastly-cli_version: 10.4.0
jobs:
build:
name: StarlingMonkey Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust 1.77.1
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
- name: Build
run: npm run build:starlingmonkey
- uses: actions/upload-artifact@v3
with:
name: starling-release
path: starling.wasm
ensure_cargo_installs:
name: Ensure that all required "cargo install" commands are run, or we have a cache hit
strategy:
matrix:
include:
- crate: viceroy
version: 0.9.4 # Note: workflow-level env vars can't be used in matrix definitions
options: ""
- crate: wasm-tools
version: 1.0.28 # Note: workflow-level env vars can't be used in matrix definitions
options: ""
runs-on: ubuntu-latest
steps:
- name: Cache ${{ matrix.crate }} ${{ matrix.version }}
id: cache-crate
uses: actions/cache@v3
with:
path: "/home/runner/.cargo/bin/${{ matrix.crate }}"
key: crate-cache-${{ matrix.crate }}-${{ matrix.version }}
- name: Install ${{ matrix.crate }} ${{ matrix.version }}
run: cargo install ${{ matrix.crate }} ${{ matrix.options }} --version ${{ matrix.version }}
if: steps.cache-crate.outputs.cache-hit != 'true'
run_wpt:
if: github.ref != 'refs/heads/main'
name: Run Web Platform Tests
needs: [build, ensure_cargo_installs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: starling-release
- name: Restore Viceroy from cache
uses: actions/cache@v3
with:
path: "/home/runner/.cargo/bin/viceroy"
key: crate-cache-viceroy-${{ env.viceroy_version }}
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: "Check wasm-tools has been restored"
if: steps.wasm-tools.outputs.cache-hit != 'true'
run: |
echo "wasm-tools was not restored from the cache"
echo "bailing out from the build early"
exit 1
- run: yarn install --frozen-lockfile
- name: Build WPT runtime
run: tests/wpt-harness/build-wpt-runtime.sh --starlingmonkey
- name: Prepare WPT hosts
run: |
cd tests/wpt-harness/wpt
./wpt make-hosts-file | sudo tee -a /etc/hosts
- name: Run tests
timeout-minutes: 20
run: node ./tests/wpt-harness/run-wpt.mjs -vv
sdktest:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
matrix:
platform: [viceroy, compute]
needs: [build]
steps:
- name: Checkout fastly/js-compute-runtime
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'yarn'
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
cli_version: ${{ env.fastly-cli_version }}
- name: Restore Viceroy from cache
if: ${{ matrix.platform == 'viceroy' }}
uses: actions/cache@v3
id: viceroy
with:
path: "/home/runner/.cargo/bin/viceroy"
key: crate-cache-viceroy-${{ env.viceroy_version }}
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: "Check caches have been restored"
if: steps.wasm-tools.outputs.cache-hit != 'true' || matrix.platform == 'viceory' && steps.viceroy.outputs.cache-hit != 'true'
run: echo "Unable to restore from the cache, bailing." && exit 1
- name: Download Engine
uses: actions/download-artifact@v3
with:
name: starling-release
- run: yarn install --frozen-lockfile
- name: Yarn install
run: yarn && cd ./integration-tests/js-compute && yarn
- run: node integration-tests/js-compute/test.js --starlingmonkey ${{ matrix.platform == 'viceroy' && '--local' || '' }}
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}