mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-09-11 05:35:33 +03:00
* Rework WASM compilation options Necessary to work with newer versions of emscripten that are more picky about which option goes to the compiler, and which to the linker. Also took the opportunity to remove the need for the patching of the bergamot-translation-worker.js file, this can now easily be done through supported apis. Furthermore, I tried to downsize the generated javascript and wasm code a bit. Initial estimates show that bergamot-translator compiled with emscripten 3.0.0 runs at about 3x the speed of 2.0.9 (when using embedded intgemm). Speed-up when using mozIntGemm is less dramatic. * Updated marian-dev submodule * Revert changes specific to patching external gemm modules for wasm * Better Compilation and Link flags - Added "-O3" optimization flag for linking as well - "-g2" only for release and debug builds - "-g1" for release builds - Replaced deprecated "--bind" flag with "-lembind" - Removed redundant link flag * Upgraded emsdk to 3.1.8 * Enclosed EXPORTED_FUNCTIONS values in a list * Fixed the remaining 2.0.9 reference in circle ci build script * Updated README Co-authored-by: Jelmer van der Linde <jelmer@ikhoefgeen.nl>
135 lines
4.2 KiB
YAML
135 lines
4.2 KiB
YAML
version: 2.1
|
|
jobs:
|
|
build-with-wormhole:
|
|
docker:
|
|
- image: 'emscripten/emsdk:3.1.8'
|
|
resource_class: medium
|
|
|
|
working_directory: ~/checkout
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- run:
|
|
name: Build WASM WORMHOLE
|
|
command: |
|
|
bash build-wasm.sh WORMHOLE
|
|
|
|
- run:
|
|
name: Check artifacts
|
|
working_directory: build-wasm
|
|
command: |
|
|
ARTIFACT_BASE="bergamot-translator-worker"
|
|
ARTIFACT_SUFFIX="with-wormhole"
|
|
ARTIFACT_FINAL=$ARTIFACT_BASE-$ARTIFACT_SUFFIX
|
|
|
|
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
|
echo "Artifacts Successfully Generated"
|
|
mkdir ../artifacts
|
|
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_FINAL.wasm
|
|
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_FINAL.js
|
|
cd ../artifacts
|
|
shasum -a 256 $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
|
ls -lsa $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
|
cp ../BERGAMOT_VERSION .
|
|
else
|
|
echo "Failure: Artifacts Not Present"
|
|
exit 1
|
|
fi
|
|
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- artifacts/*
|
|
|
|
- store_artifacts:
|
|
path: "artifacts"
|
|
destination: "wasm-wormhole"
|
|
|
|
build-without-wormhole:
|
|
docker:
|
|
- image: 'emscripten/emsdk:3.1.8'
|
|
resource_class: medium
|
|
|
|
working_directory: ~/checkout
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- run:
|
|
name: Build WASM
|
|
command: |
|
|
bash build-wasm.sh
|
|
|
|
- run:
|
|
name: Check artifacts
|
|
working_directory: build-wasm
|
|
command: |
|
|
ARTIFACT_BASE="bergamot-translator-worker"
|
|
ARTIFACT_SUFFIX="without-wormhole"
|
|
ARTIFACT_FINAL=$ARTIFACT_BASE-$ARTIFACT_SUFFIX
|
|
|
|
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
|
echo "Artifacts Successfully Generated"
|
|
mkdir ../artifacts
|
|
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_FINAL.wasm
|
|
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_FINAL.js
|
|
cd ../artifacts
|
|
shasum -a 256 $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
|
ls -lsa $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
|
else
|
|
echo "Failure: Artifacts Not Present"
|
|
exit 1
|
|
fi
|
|
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- artifacts/*
|
|
|
|
- store_artifacts:
|
|
path: "artifacts"
|
|
destination: "wasm-without-wormhole"
|
|
|
|
publish_to_github:
|
|
docker:
|
|
- image: cibuilds/github:0.10
|
|
steps:
|
|
- attach_workspace:
|
|
# Must be absolute path or relative path from working_directory
|
|
at: ./
|
|
- when:
|
|
condition:
|
|
equal: [ 'https://github.com/mozilla/bergamot-translator', << pipeline.project.git_url >> ]
|
|
steps:
|
|
- run:
|
|
name: "Publish Release on GitHub"
|
|
command: |
|
|
export TAG_VERSION=$(cat ./artifacts/BERGAMOT_VERSION)
|
|
cat ./artifacts/sha256-filesize-without-wormhole ./artifacts/sha256-filesize-with-wormhole >> ./artifacts/sha256-filesize
|
|
rm ./artifacts/sha256-filesize-without-wormhole ./artifacts/sha256-filesize-with-wormhole ./artifacts/BERGAMOT_VERSION
|
|
ghr -t ${GHTOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${TAG_VERSION} ./artifacts/
|
|
|
|
workflows:
|
|
build:
|
|
jobs:
|
|
- build-with-wormhole:
|
|
filters:
|
|
tags:
|
|
only: /^v.*/
|
|
- build-without-wormhole:
|
|
filters:
|
|
tags:
|
|
only: /^v.*/
|
|
- publish_to_github:
|
|
filters:
|
|
tags:
|
|
only: /^v.*/
|
|
branches:
|
|
ignore: /.*/
|
|
requires:
|
|
- build-without-wormhole
|
|
- build-with-wormhole
|
|
|
|
|