name: CI
on:
push:
branches: [master]
tags: ['[0-9]*']
pull_request:
branches: [master]
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@master
- name: Install Rust (rustup)
run: rustup update stable --no-self-update && rustup default stable
shell: bash
- name: Install wasmtime (macos)
run: |
set -e
curl -L https://github.com/CraneStation/wasmtime/releases/download/dev/wasmtime-dev-x86_64-macos.tar.xz | tar xJf -
echo ::add-path::`pwd`/wasmtime-dev-x86_64-macos
if: matrix.os == 'macos-latest'
- name: Install wasmtime (linux)
run: |
set -e
curl -L https://github.com/CraneStation/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | tar xJf -
echo ::add-path::`pwd`/wasmtime-dev-x86_64-linux
if: matrix.os == 'ubuntu-latest'
- name: Install wasmtime (windows)
run: |
set -e
curl -LO https://github.com/CraneStation/wasmtime/releases/download/dev/wasmtime-dev-x86_64-windows.zip
unzip wasmtime-dev-x86_64-windows.zip
echo ::add-path::D:/a/cargo-wasi/cargo-wasi/wasmtime-dev-x86_64-windows
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@master
- name: Install Rust
run: rustup update beta && rustup update stable && rustup default beta
- run: cargo install --debug --path .
- run: (cd examples/hello-world && cargo +stable wasi build --release -v)
- run: (cd examples/hello-world && cargo +beta wasi build --release -v)
- run: (cd examples/markdown && cargo wasi build --release -v)
- run: (cd examples/markdown && cargo 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@master
- name: Install Rust (rustup)
run: rustup update stable --no-self-update && rustup default stable
shell: bash
- run: rustup target add ${{ matrix.target }}
- name: Configure OSX deployment target
run: echo ::set-env name=MACOSX_DEPLOYMENT_TARGET::10.7
if: matrix.os == 'macos-latest'
- name: Configure Windows build flags
run: echo ::set-env name=RUSTFLAGS::-Ctarget-feature=+crt-static
if: matrix.os == 'windows-latest'
- name: Install musl-gcc
run: sudo apt update -y && sudo apt install -y musl-tools
if: matrix.os == 'ubuntu-latest'
- run: cargo build --release --target ${{ matrix.target }} --features reqwest/native-tls-vendored
- 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@master
- 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@master
- 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 ::add-path::`pwd`
- 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/master'
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update stable && rustup default stable
- 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
- name: Configure release env vars
run: |
echo ::set-env name=NO_DRY_RUN::1
echo ::set-env name=CARGO_REGISTRY_TOKEN::${{ secrets.CARGO_REGISTRY_TOKEN }}
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
- run: cargo run -p assemble --bin weave