mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-09-11 05:35:33 +03:00
Circle CI wasm artifacts for non-wormhole builds
This commit is contained in:
parent
cafb65e0b5
commit
8e4374282a
@ -1,6 +1,37 @@
|
||||
version: 2.1
|
||||
jobs:
|
||||
build:
|
||||
build-with-wormhole:
|
||||
docker:
|
||||
- image: 'emscripten/emsdk:2.0.9'
|
||||
resource_class: medium
|
||||
|
||||
working_directory: ~/checkout
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- run:
|
||||
name: Build WASM
|
||||
command: bash build-wasm.sh WORMHOLE
|
||||
|
||||
- run:
|
||||
name: Check artifacts
|
||||
working_directory: build-wasm
|
||||
command: |
|
||||
ls -all bergamot*
|
||||
if ls bergamot*.wasm &>/dev/null && ls bergamot*.js &>/dev/null
|
||||
then
|
||||
echo "Artifacts Successfully Generated"
|
||||
else
|
||||
echo "Failure: Artifacts Not Present"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- store_artifacts:
|
||||
path: "build-wasm"
|
||||
destination: "wasm-wormhole"
|
||||
|
||||
build-without-wormhole:
|
||||
docker:
|
||||
- image: 'emscripten/emsdk:2.0.9'
|
||||
resource_class: medium
|
||||
@ -29,4 +60,10 @@ jobs:
|
||||
|
||||
- store_artifacts:
|
||||
path: "build-wasm"
|
||||
destination: "build-wasm"
|
||||
destination: "wasm-without-wormhole"
|
||||
|
||||
workflows:
|
||||
build:
|
||||
jobs:
|
||||
- build-with-wormhole
|
||||
- build-without-wormhole
|
@ -1,15 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: ./build-wasm.sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Usage
|
||||
Usage="Build translator to wasm (with/without wormhole).
|
||||
|
||||
Usage: $(basename "$0") [WORMHOLE]
|
||||
|
||||
where:
|
||||
WORMHOLE An optional string argument
|
||||
- when specified on command line, builds wasm artifacts with wormhole
|
||||
- when not specified (the default behaviour), builds wasm artifacts without wormhole."
|
||||
|
||||
if [ "$#" -gt 1 ]; then
|
||||
echo "Illegal number of parameters passed"
|
||||
echo "$Usage"
|
||||
exit
|
||||
fi
|
||||
|
||||
WORMHOLE=false
|
||||
|
||||
if [ "$#" -eq 1 ]; then
|
||||
if [ "$1" = "WORMHOLE" ]; then
|
||||
WORMHOLE=true
|
||||
else
|
||||
echo "Illegal parameter passed"
|
||||
echo "$Usage"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run script from the context of the script-containing directory
|
||||
cd "$(dirname $0)"
|
||||
|
||||
# This file replicates the instructions found in ./README.md under "Build WASM"
|
||||
|
||||
# Prerequisite: Download and Install Emscripten using following instructions (unless the EMSDK env var is already set)
|
||||
if [ "$EMSDK" == "" ]; then
|
||||
EMSDK_UPDATE_REQUIRED=0
|
||||
@ -36,17 +59,24 @@ if [ "$EMSDK" == "" ]; then
|
||||
fi
|
||||
|
||||
# Compile
|
||||
# 1. Create a folder where you want to build all the artifacts (`build-wasm` in this case) and compile
|
||||
if [ ! -d "build-wasm" ]; then
|
||||
mkdir build-wasm
|
||||
# 1. Create a folder where you want to build all the artifacts and compile
|
||||
BUILD_DIRECTORY="build-wasm"
|
||||
if [ ! -d ${BUILD_DIRECTORY} ]; then
|
||||
mkdir ${BUILD_DIRECTORY}
|
||||
fi
|
||||
cd build-wasm
|
||||
cd ${BUILD_DIRECTORY}
|
||||
|
||||
if [ "$WORMHOLE" = true ]; then
|
||||
emcmake cmake -DCOMPILE_WASM=on ../
|
||||
else
|
||||
emcmake cmake -DCOMPILE_WASM=on -DWORMHOLE=off ../
|
||||
fi
|
||||
emmake make -j2
|
||||
|
||||
# 2. Enable SIMD Wormhole via Wasm instantiation API in generated artifacts
|
||||
if [ "$WORMHOLE" = true ]; then
|
||||
bash ../wasm/patch-artifacts-enable-wormhole.sh
|
||||
fi
|
||||
|
||||
# The artifacts (.js and .wasm files) will be available in the build directory ("build-wasm" in this case).
|
||||
|
||||
# The artifacts (.js and .wasm files) will be available in the build directory
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user