Skip to content

Add basic CI GitHub workflow #10

Add basic CI GitHub workflow

Add basic CI GitHub workflow #10

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
ci:
runs-on: shopify-ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-wasi
run: cargo install --force cargo-wasi
- name: Install Wizer
env:
WIZER_VERSION: 3.0.0
run: |
wget -nv https://github.com/bytecodealliance/wizer/releases/download/v${WIZER_VERSION}/wizer-v${WIZER_VERSION}-x86_64-linux.tar.xz -O /tmp/wizer.tar.xz
mkdir /tmp/wizer
tar xvf /tmp/wizer.tar.xz --strip-components=1 -C /tmp/wizer
echo "/tmp/wizer" >> $GITHUB_PATH
- name: Install Wasmtime
env:
WASMTIME_VERSION: 12.0.2
run: |
wget -nv https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-x86_64-linux.tar.xz -O /tmp/wasmtime.tar.xz
mkdir /tmp/wasmtime
tar xvf /tmp/wasmtime.tar.xz --strip-components=1 -C /tmp/wasmtime
echo "/tmp/wasmtime" >> $GITHUB_PATH
- name: Download WASI SDK
run: make download-wasi-sdk
- name: Compile core
run: cargo build --package=core --release --target=wasm32-wasi && wizer --allow-wasi --wasm-bulk-memory true target/wasm32-wasi/release/core.wasm -o crates/cli/engine.wasm
- name: Test core
run: cargo wasi test --package=core --release -- --nocapture
- name: Compile CLI
run: cargo build --package=cli
# TODO replace this and the run module step with an integration test that compiles and executes the module.
- name: Run CLI
run: cargo run --package=cli ruby_examples/hello_world.rb
- name: Run module
run: wasmtime index.wasm