Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Co-authored-by: Yusuke Endoh <[email protected]>
  • Loading branch information
kateinoigakukun and mame committed Feb 16, 2022
0 parents commit bacd766
Show file tree
Hide file tree
Showing 74 changed files with 7,149 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI
on: [push]

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cargo check --all
- run: cargo fmt --all -- --check

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install wasmtime
run: |
set -e
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/${WASMTIME_VERSION}/wasmtime-${WASMTIME_VERSION}-x86_64-linux.tar.xz | tar xJf -
echo "$PWD/wasmtime-${WASMTIME_VERSION}-x86_64-linux" >> $GITHUB_PATH
env:
WASMTIME_VERSION: v0.34.0
- name: Install wasi-sdk
run: |
set -e
wasi_sdk_deb="wasi-sdk_${WASI_SDK_VERSION_MAJOR}.${WASI_SDK_VERSION_MINOR}_amd64.deb"
wget "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION_MAJOR}/${wasi_sdk_deb}"
sudo dpkg -i "$wasi_sdk_deb"
echo "WASI_SDK_PATH=/opt/wasi-sdk" >> $GITHUB_ENV
env:
WASI_SDK_VERSION_MAJOR: 14
WASI_SDK_VERSION_MINOR: 0
- run: CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime cargo test --target wasm32-wasi
- run: cargo build --target wasm32-unknown-unknown
- run: LIB_WASI_VFS_A=$PWD/target/wasm32-unknown-unknown/debug/libwasi_vfs.a ./tools/run-make-test.sh
145 changes: 145 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build-wasi-vfs-cli:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-apple-darwin
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/[email protected]
with:
command: build
args: --release --target=${{ matrix.target }} --package wasi-vfs-cli
use-cross: true

- run: |
zip --junk-paths wasi-vfs-cli-${{ matrix.target }} target/${{ matrix.target }}/release/wasi-vfs{,.exe}
- uses: actions/upload-artifact@v1
with:
name: wasi-vfs-cli-${{ matrix.target }}
path: wasi-vfs-cli-${{ matrix.target }}.zip
build-libwasi-vfs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install wasi-sdk
run: |
set -e
wasi_sdk_deb="wasi-sdk_${WASI_SDK_VERSION_MAJOR}.${WASI_SDK_VERSION_MINOR}_amd64.deb"
wget "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION_MAJOR}/${wasi_sdk_deb}"
sudo dpkg -i "$wasi_sdk_deb"
echo "WASI_SDK_PATH=/opt/wasi-sdk" >> $GITHUB_ENV
env:
WASI_SDK_VERSION_MAJOR: 14
WASI_SDK_VERSION_MINOR: 0
- uses: actions-rs/[email protected]
with:
command: build
args: --release --target=wasm32-unknown-unknown
- run: |
zip --junk-paths libwasi_vfs-wasm32-unknown-unknown target/wasm32-unknown-unknown/release/libwasi_vfs.a
- uses: actions/upload-artifact@v1
with:
name: libwasi_vfs-wasm32-unknown-unknown
path: libwasi_vfs-wasm32-unknown-unknown.zip

create-release:
needs: [build-wasi-vfs-cli, build-libwasi-vfs]
runs-on: ubuntu-latest
steps:
- id: create-release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- run: |
echo '${{ steps.create-release.outputs.upload_url }}' > release_upload_url.txt
- uses: actions/upload-artifact@v1
with:
name: create-release
path: release_upload_url.txt
upload-cli-release:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v1
with:
name: create-release
- id: upload-url
run: |
echo "::set-output name=url::$(cat create-release/release_upload_url.txt)"
- uses: actions/download-artifact@v1
with:
name: wasi-vfs-cli-${{ matrix.target }}
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.upload-url.outputs.url }}
asset_path: ./wasi-vfs-cli-${{ matrix.target }}/wasi-vfs-cli-${{ matrix.target }}.zip
asset_name: wasi-vfs-cli-${{ matrix.target }}.zip
asset_content_type: application/zip

upload-lib-release:
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v1
with:
name: create-release
- id: upload-url
run: |
echo "::set-output name=url::$(cat create-release/release_upload_url.txt)"
- uses: actions/download-artifact@v1
with:
name: libwasi_vfs-wasm32-unknown-unknown
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.upload-url.outputs.url }}
asset_path: ./libwasi_vfs-wasm32-unknown-unknown/libwasi_vfs-wasm32-unknown-unknown.zip
asset_name: libwasi_vfs-wasm32-unknown-unknown.zip
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "crates/wasi-libc-trampoline-bindgen/WASI"]
path = crates/wasi-libc-trampoline-bindgen/WASI
url = https://github.com/WebAssembly/WASI.git
Loading

0 comments on commit bacd766

Please sign in to comment.