mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-09-11 13:46:12 +03:00
9e1c1e8dbf
- Robust artifact presence check - Variable name refactoring - Storing only those artifacts that are required - Remove commit sha from the names of the Github Releases - Use BERGAMOT_VERSION file contents for Git Tag names
122 lines
3.5 KiB
YAML
122 lines
3.5 KiB
YAML
version: 2.1
|
|
jobs:
|
|
build-with-wormhole:
|
|
docker:
|
|
- image: 'emscripten/emsdk:2.0.9'
|
|
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"
|
|
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
|
echo "Artifacts Successfully Generated"
|
|
mkdir ../artifacts
|
|
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_BASE-with-wormhole.wasm
|
|
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_BASE-with-wormhole.js
|
|
shasum -a 256 ../artifacts/* > ../artifacts/SHA256-1
|
|
cp ../BERGAMOT_VERSION ../artifacts/
|
|
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:2.0.9'
|
|
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"
|
|
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
|
echo "Artifacts Successfully Generated"
|
|
mkdir ../artifacts
|
|
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_BASE-without-wormhole.wasm
|
|
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_BASE-without-wormhole.js
|
|
shasum -a 256 ../artifacts/* > ../artifacts/SHA256-2
|
|
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: ./
|
|
- run:
|
|
name: "Publish Release on GitHub"
|
|
command: |
|
|
export TAG_VERSION=$(cat ./artifacts/BERGAMOT_VERSION)
|
|
ls -lsa ./artifacts/ > ./artifacts/FILESIZES
|
|
cat ./artifacts/SHA256-1 ./artifacts/SHA256-2 > ./artifacts/SHA256
|
|
rm ./artifacts/SHA256-1 ./artifacts/SHA256-2 ./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
|
|
|
|
|