Skip to content

Update wasm-bindgen.md #313

Update wasm-bindgen.md

Update wasm-bindgen.md #313

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ['[0-9]*']
pull_request:
branches: [main]
jobs:
test:
name: Test
env:
WASMTIME_RELEASE: v0.38.0
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Install Rust (rustup)
run: rustup update stable --no-self-update && rustup default stable
shell: bash
- name: Install wasmtime (macos)
run: |
set -ex
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/$WASMTIME_RELEASE/wasmtime-$WASMTIME_RELEASE-x86_64-macos.tar.xz | tar xJf -
echo `pwd`/wasmtime-$WASMTIME_RELEASE-x86_64-macos >> $GITHUB_PATH
if: matrix.os == 'macos-latest'
- name: Install wasmtime (linux)
run: |
set -ex
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/$WASMTIME_RELEASE/wasmtime-$WASMTIME_RELEASE-x86_64-linux.tar.xz | tar xJf -
echo `pwd`/wasmtime-$WASMTIME_RELEASE-x86_64-linux >> $GITHUB_PATH
if: matrix.os == 'ubuntu-latest'
- name: Install wasmtime (windows)
run: |
set -ex
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/$WASMTIME_RELEASE/wasmtime-$WASMTIME_RELEASE-x86_64-windows.zip
unzip wasmtime-$WASMTIME_RELEASE-x86_64-windows.zip
echo D:/a/cargo-wasi/cargo-wasi/wasmtime-$WASMTIME_RELEASE-x86_64-windows >> $GITHUB_PATH
shell: bash
if: matrix.os == 'windows-latest'
- run: cargo build
- run: cargo test
- run: cargo test -p cargo-wasi-shim
- run: cargo build -p assemble
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update beta && rustup update stable && rustup default beta
- run: cargo install --debug --path .
# Verify that we can switch between channels (stable/beta) and we'll
# automatically get the wasi target on both.
- run: (cd examples/hello-world && cargo +stable wasi build --release -v)
- run: (cd examples/hello-world && cargo +beta wasi build --release -v)
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- x86_64-apple-darwin
- x86_64-unknown-linux-musl
- x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
steps:
- uses: actions/checkout@v2
- name: Install Rust (rustup)
run: rustup update stable --no-self-update && rustup default stable
shell: bash
- run: rustup target add ${{ matrix.target }}
# Target older versions of OSX (as old as we reasonably can) to ensure we
# can run across a wide variety of systems.
- name: Configure OSX deployment target
run: echo MACOSX_DEPLOYMENT_TARGET=10.7 >> $GITHUB_ENV
if: matrix.os == 'macos-latest'
# Don't link the CRT dynamically to increase our binary compatibility.
- name: Configure Windows build flags
run: echo RUSTFLAGS=-Ctarget-feature=+crt-static >> $GITHUB_ENV
if: matrix.os == 'windows-latest'
# Install a musl toolchain if we're on Linux
- name: Install musl-gcc
run: sudo apt update -y && sudo apt install -y musl-tools
if: matrix.os == 'ubuntu-latest'
# Build our actual binary
- run: cargo build --release --target ${{ matrix.target }} --features reqwest/native-tls-vendored
# Plop the binary plus a `*.crate` file for the corresponding
# target-specific package in `tmp` and upload the artifact.
- run: cargo run -p assemble --bin krate ${{ matrix.target }} target/${{ matrix.target }}/release/cargo-wasi${{ matrix.ext }}
- name: Publish binary build
uses: actions/upload-artifact@v1
with:
name: cargo-wasi-${{ matrix.target }}
path: tmp
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check
book:
name: Book Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Install mdbook
run: |
set -e
curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.0/mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
echo `pwd` >> $GITHUB_PATH
- run: cd doc && mdbook build
- name: Push to gh-pages
run: curl -LsSf https://git.io/fhJ8n | rustc - && (cd doc/book && ../../rust_out)
env:
GITHUB_DEPLOY_KEY: ${{ secrets.GITHUB_DEPLOY_KEY }}
BUILD_REPOSITORY_ID: ${{ github.repository }}
BUILD_SOURCEVERSION: ${{ github.sha }}
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update stable && rustup default stable
# Download artiacts produced in build step
- name: Download OSX
uses: actions/download-artifact@v1
with:
name: cargo-wasi-x86_64-apple-darwin
- name: Download Linux
uses: actions/download-artifact@v1
with:
name: cargo-wasi-x86_64-unknown-linux-musl
- name: Download Windows
uses: actions/download-artifact@v1
with:
name: cargo-wasi-x86_64-pc-windows-msvc
# On tags we actually publish crates, so configure env vars if this is a git
# tag.
- name: Configure release env vars
run: |
echo NO_DRY_RUN=1 >> $GITHUB_ENV
echo CARGO_REGISTRY_TOKEN=${{ secrets.CARGO_REGISTRY_TOKEN }} >> $GITHUB_ENV
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
# Take all the input `*.crate` files and run various checks. Additionally
# assemble the "real" `cargo-wasi` crate which is published on crates.io.
- run: cargo run -p assemble --bin weave