Skip to content

Commit

Permalink
Improved install script
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Apr 11, 2019
1 parent 8180771 commit e5d0b37
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 18 deletions.
22 changes: 20 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ jobs:
- image: circleci/rust:latest
steps:
- checkout
# - run:
# name: "Pull dependencies"
# command: |
# git clone [email protected]:wasmerio/wapm-cli.git
- restore_cache:
keys:
- v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
Expand Down Expand Up @@ -170,12 +174,14 @@ jobs:
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
make release
# cargo build --release --manifest-path wapm-cli/Cargo.toml
mkdir -p artifacts
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
# GIT_VERSION=$(git describe --exact-match --tags)
echo "${VERSION}" >> artifacts/version
echo "${CIRCLE_TAG}" >> artifacts/git_version
cp ./target/release/wasmer ./artifacts/$(./binary-name.sh)
make build-install
cp ./wasmer.tar.gz ./artifacts/$(./binary-name.sh)
- run:
name: Debug flag checked
command: |
Expand All @@ -193,13 +199,20 @@ jobs:
- target/release/.fingerprint
- target/release/build
- target/release/deps
# - wapm-cli/target/release/.fingerprint
# - wapm-cli/target/release/build
# - wapm-cli/target/release/deps
key: v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}

test-and-build-macos:
macos:
xcode: "9.0"
steps:
- checkout
# - run:
# name: "Pull dependencies"
# command: |
# git clone [email protected]:wasmerio/wapm-cli.git
- restore_cache:
keys:
- v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
Expand Down Expand Up @@ -250,10 +263,12 @@ jobs:
export PATH="$HOME/.cargo/bin:$PATH"
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/"
make release
# cargo build --release --manifest-path wapm-cli/Cargo.toml
mkdir -p artifacts
make build-install
cp ./wasmer.tar.gz ./artifacts/$(./binary-name.sh)
# VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
# echo "${VERSION}" >> artifacts/version
cp ./target/release/wasmer ./artifacts/$(./binary-name.sh)
- persist_to_workspace:
root: .
paths:
Expand All @@ -267,6 +282,9 @@ jobs:
- target/release/.fingerprint
- target/release/build
- target/release/deps
# - wapm-cli/target/release/.fingerprint
# - wapm-cli/target/release/build
# - wapm-cli/target/release/deps
key: v8-cargo-cache-darwin-nightly-{ arch }}-{{ checksum "Cargo.lock" }}

test-rust-nightly:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.DS_Store
.idea
**/.vscode
install/
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ lint:

precommit: lint test

build-install:
mkdir -p ./install/bin
# cp ./wapm-cli/target/release/wapm ./install/bin/
cp ./target/release/wasmer ./install/bin/
tar -C ./install -zcvf wasmer.tar.gz bin/wapm bin/wasmer

# For installing the contents locally
do-install:
tar -C ~/.wasmer -zxvf wasmer.tar.gz

test:
# We use one thread so the emscripten stdouts doesn't collide
cargo test --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-singlepass-backend -- $(runargs)
Expand Down
14 changes: 7 additions & 7 deletions binary-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ initOS() {
darwin) OS='darwin';;
linux) OS='linux';;
freebsd) OS='freebsd';;
mingw*) OS='windows';;
msys*) OS='windows';;
# mingw*) OS='windows';;
# msys*) OS='windows';;
*) echo "OS ${OS} is not supported by this installation script"; exit 1;;
esac
}
Expand All @@ -34,11 +34,11 @@ initArch
initOS

# determine install directory if required
BINARY="wasmer-${OS}-${ARCH}"
BINARY="wasmer-${OS}-${ARCH}.tar.gz"

# add .exe if on windows
if [ "$OS" = "windows" ]; then
BINARY="$BINARY.exe"
fi
# if [ "$OS" = "windows" ]; then
# BINARY="$BINARY.exe"
# fi

echo "${BINARY}"
17 changes: 8 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ white="\033[37m"
bold="\e[1m"
dim="\e[2m"

# Warning: Remove this on the public repo
RELEASES_URL="https://github.com/wasmerio/wasmer/releases"

wasmer_download_json() {
Expand Down Expand Up @@ -369,12 +370,12 @@ wasmer_download() {
WASMER=INSTALL_DIRECTORY

# assemble expected release artifact name
BINARY="wasmer-${OS}-${ARCH}"
BINARY="wasmer-${OS}-${ARCH}.tar.gz"

# add .exe if on windows
if [ "$OS" = "windows" ]; then
BINARY="$BINARY.exe"
fi
# if [ "$OS" = "windows" ]; then
# BINARY="$BINARY.exe"
# fi

# if WASMER_RELEASE_TAG was not provided, assume latest
if [ -z "$WASMER_RELEASE_TAG" ]; then
Expand Down Expand Up @@ -417,9 +418,6 @@ wasmer_download() {
printf "\033[K\n\033[1A"
# printf "\033[1A$cyan> Downloaded$reset\033[K\n"
# echo "Setting executable permissions."
chmod +x "$DOWNLOAD_FILE"

INSTALL_NAME="wasmer"

# windows not supported yet
# if [ "$OS" = "windows" ]; then
Expand All @@ -428,8 +426,9 @@ wasmer_download() {

# echo "Moving executable to $INSTALL_DIRECTORY/$INSTALL_NAME"

mkdir -p $INSTALL_DIRECTORY/bin
mv "$DOWNLOAD_FILE" "$INSTALL_DIRECTORY/bin/$INSTALL_NAME"
mkdir -p $INSTALL_DIRECTORY
# Untar the wasmer contents in the install directory
tar -C $INSTALL_DIRECTORY -zxvf $DOWNLOAD_FILE
}

wasmer_verify_or_quit() {
Expand Down

0 comments on commit e5d0b37

Please sign in to comment.