Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .circleci/bash_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

bashrc_env_file="~/.bashrc"
emscripten_env_file="/root/emsdk-portable/emsdk_env.sh"

[ -f "${bashrc_env_file}" ] && source "${bashrc_env_file}"
[ -f "${emscripten_env_file}" ] && source "${emscripten_env_file}"
23 changes: 23 additions & 0 deletions .circleci/build_emscripten.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

emconfigure cmake -DBUILD_WEBASSEMBLY=ON -DCMAKE_BUILD_TYPE=Release
emmake make

# FIXME: Disable .mem for node.js until this gets fixed: https://github.com/kripken/emscripten/issues/2542
emcc --bind libjsqrl.so -s DISABLE_EXCEPTION_CATCHING=0 -O3 --memory-init-file 0 -o libjsqrl.js
emcc --bind libjsqrl.so -s DISABLE_EXCEPTION_CATCHING=0 -O3 -s WASM=1 -o web-libjsqrl.js
echo "QRLLIB=Module;" >> web-libjsqrl.js

# Fix paths of web-libjsqrl.wasm for web clients
sed -i 's/web-libjsqrl\.wasm/\/web-libjsqrl\.wasm/g' web-libjsqrl.js

# Copy to local dir in case it is run locally, the output is shared
if test -d /tmp/_circleci_local_build_repo; then cp *.js /tmp/_circleci_local_build_repo/tests/js/tmp/; fi
if test -d /tmp/_circleci_local_build_repo; then cp *.wasm /tmp/_circleci_local_build_repo/tests/js/tmp/; fi
if test -d /tmp/_circleci_local_build_repo; then chmod 777 /tmp/_circleci_local_build_repo/tests/js/tmp/*; fi

cp *.js tests/js/tmp/
cp *.wasm tests/js/tmp/

cp *.js build/
cp *.wasm build/
125 changes: 125 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
version: 2
jobs:
build:
docker:
- image: zondax/qrl-build-images:xenial-qrllib
steps:
- checkout
- run: git submodule update --init --recursive
- run: cmake -DBUILD_PYTHON=ON -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5
- run: make
- run: export GTEST_COLOR=1 && ctest -VV

test_python:
docker:
- image: zondax/qrl-build-images:xenial-qrllib
steps:
- checkout
- run: git submodule update --init --recursive
- run: python3 setup.py test

build_emscripten:
docker:
- image: zondax/qrl-build-images:emscripten
environment:
BASH_ENV: ".circleci/bash_env.sh"
steps:
- checkout
- run:
name: Update submodules
command: git submodule update --init --recursive

- run:
name: Build webassembly
command: ./.circleci/build_emscripten.sh

- run:
name: Install latest node/npm
command: ./.circleci/install_node.sh

- run:
name: run the tests
command: cd tests/js && npm install && npm test

deploy_pypi:
docker:
- image: qrledger/qrl-docker:xenial
steps:
- checkout
- run: git submodule update --init --recursive
- run: python3 setup.py build sdist
- run: pip install twine
- run: twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD dist/*

deploy_npm:
docker:
- image: zondax/qrl-build-images:emscripten
environment:
BASH_ENV: ".circleci/bash_env.sh"
steps:
- checkout
- run:
name: Update submodules
command: git submodule update --init --recursive

# Building again and avoiding complex workspaces until they are supported in the CLI
- run:
name: Build webassembly
command: ./.circleci/build_emscripten.sh

- run:
name: Install latest node/npm
command: ./.circleci/install_node.sh

- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > /root/project/.npmrc

- run:
name: Update tag
command: npm --no-git-tag-version version $CIRCLE_TAG

- run:
name: Publish package
command: npm publish

workflows:
version: 2
build_all:
jobs:
- build:
filters:
tags:
only: /.*/

- test_python:
filters:
tags:
only: /.*/

- build_emscripten:
filters:
tags:
only: /.*/

- deploy_pypi:
requires:
- build
- test_python
- build_emscripten
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+)*/

- deploy_npm:
requires:
- build
- test_python
- build_emscripten
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+)*/
13 changes: 13 additions & 0 deletions .circleci/install_node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

nvm install node
npm install -g npm@latest

echo "Node Version :" $(node -v)
echo "NPM Version :" $(npm -v)
echo
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ gtest\.pc
qrllib_test

cmake-build-onlylib/
build/
\.idea/workspace\.xml
\.coverage
coverage\.xml
Expand All @@ -67,3 +66,9 @@ pyqrllib/kyber\.py
pyqrllib/kyberPYTHON_wrap\.cxx

pyqrllib/qrlPYTHON_wrap\.cxx
.pytest_cache
tests/js/node_modules
tests/js/tmp/*.js
tests/js/tmp/*.wasm

\.npmrc
119 changes: 0 additions & 119 deletions .travis.yml

This file was deleted.

Loading