From 40baf57b20be0a71ac9b739c44a66dd65a1f1625 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 24 Jun 2021 22:20:52 +0900 Subject: [PATCH] update --- .github/workflows/release.yml | 16 +++++++ README.md | 42 ++++++++++++++++-- script/release | 84 +++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100755 script/release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f5e3d7a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,16 @@ +name: Release +on: + workflow_dispatch: + inputs: + version: + description: 'version' + required: true + +jobs: + release: + runs-on: [macos-latest] + steps: + - uses: actions/checkout@v1 + + - name: Release + run: ./script/release ${{ github.event.inputs.version }} ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index bf802da..bd4fc70 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ - - - [![CI](https://github.com/k-nasa/wasmi/actions/workflows/ci.yml/badge.svg)](https://github.com/k-nasa/wasmi/actions/workflows/ci.yml) # wasmi (in progress) @@ -13,3 +10,42 @@ This is an ongoing project ## DEMO https://user-images.githubusercontent.com/23740172/123268043-a353e000-d538-11eb-9c9a-bef00b4528e0.mov + +## Usage + +```bash +:) % wasmi -h +wasmi 0.1.0 +k-nasa +A simple wasm interpreter + +USAGE: + wasmi [OPTIONS] --invoke + +ARGS: + + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + -a, --args ... + -i, --invoke +``` + +## Contribution + +1. Fork it ( http://github.com/k-nasa/wasmi ) +2. Create your feature branch (git checkout -b my-new-feature) +3. Commit your changes (git commit -am 'Add some feature') +4. Push to the branch (git push origin my-new-feature) +5. Create new Pull Request + +## Licence + +[MIT](https://github.com/k-nasa/wasmi/blob/master/LICENCE) + +## Author + +[k-nasa](https://github.com/k-nasa) diff --git a/script/release b/script/release new file mode 100755 index 0000000..465217e --- /dev/null +++ b/script/release @@ -0,0 +1,84 @@ +#!/bin/bash +# This script is used for release binary +# Usage: ./release version GITHUB_TOKEN + + +info () { + printf "\r [ \033[00;34mINFO\033[0m ] $1\n" +} + +success () { + printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n" +} + +install_cross() { + cross --version > /dev/null + if [ $? -ne 0 ]; then + info 'cross not found. try install cross' + + cargo install cross + + success "success install cross" + else + info "cross already installed" + fi +} + +install_rgh() { + rgh --version > /dev/null + if [ $? -ne 0 ]; then + info 'rgh not found. try install rgh' + + cargo install rgh + + success "success install rgh" + else + info "rgh already installed" + fi +} + +build_all() { + rm -rf dist/ + + build x86_64-apple-darwin wasmi + build x86_64-unknown-linux-gnu wasmi +} + +build() { + CRATE_NAME=wasmi + MISC="README.md LICENSE" + + TARGET=$1 + BIN_NAME=$2 + DIRNAME=${CRATE_NAME}_${TARGET} + + info "start build ${TARGET} ${BIN_NAME}" + + cross build --target ${TARGET} --release + mkdir -p ${DIRNAME} + \ + cp ./target/${TARGET}/release/${BIN_NAME} ${DIRNAME} + cp ${MISC} ${DIRNAME} + \ + mkdir -p dist + tar czf dist/${DIRNAME}.tar.gz ${DIRNAME} + rm -rf ${DIRNAME} + + success "success build ${TARGET} ${BIN_NAME}" +} + +release() { + VERSION=$1 + GITHUB_TOKEN=$2 + rgh $VERSION ./dist --token $GITHUB_TOKEN +} + +main() { + install_cross + install_rgh + + build_all + release $1 $2 +} + +main $1 $2