Skip to content

Commit

Permalink
ci: add CircleCI config file
Browse files Browse the repository at this point in the history
  • Loading branch information
maltemoeser committed Apr 9, 2020
1 parent 5063959 commit 4b361a9
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .circleci/build_ubuntu_cpp.sh
@@ -0,0 +1,13 @@
set -ev
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt install gcc-7 g++-7 libtool autoconf libboost-filesystem-dev libboost-iostreams-dev libboost-serialization-dev libboost-thread-dev libboost-test-dev libssl-dev libjsoncpp-dev libcurl4-openssl-dev libjsoncpp-dev libjsonrpccpp-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev libjemalloc-dev libsparsehash-dev
sudo apt-get install ruby-full -y # only needed for caching
gem install mtime_cache # only needed for caching

if [ ! -d ~/cmake-3.17.0-Linux-x86_64 ]; then
echo "No cache - downloading CMake"
cd ~ && wget --quiet https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.tar.gz && tar -xf cmake-3.17.0-Linux-x86_64.tar.gz
else
echo "Cached CMake found"
fi
4 changes: 4 additions & 0 deletions .circleci/build_ubuntu_python.sh
@@ -0,0 +1,4 @@
set -ev
pip3 install -U pip setuptools
pip3 install pytest pytest-regtest pytz tzlocal pytest-benchmark
pip3 install sphinx sphinx_rtd_theme
11 changes: 11 additions & 0 deletions .circleci/compile_ubuntu_cpp.sh
@@ -0,0 +1,11 @@
set -ev
which cmake
cmake -version
mkdir -p release
cd release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
mtime_cache ../**/*.{%{cpp}} -c ../.mtime_cache/cache.json
make -j 2
make install
mtime_cache /home/circleci/.local/**/*.{%{cpp}} -c ../.mtime_cache/blocksci.json
cd ..
3 changes: 3 additions & 0 deletions .circleci/compile_ubuntu_python.sh
@@ -0,0 +1,3 @@
set -ev
sed -i 's/j4/j2/g' blockscipy/setup.py
CC=gcc-7 CXX=g++-7 pip3 install -v -e blockscipy
75 changes: 75 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,75 @@
version: 2
jobs:
build:
machine:
image: ubuntu-1604:201903-01
branches:
only:
- v0.6
environment:
CC: gcc-7
CXX: g++-7
steps:
- run:
name: Setup Environment Variables
command: |
echo "export PYENV_ROOT=/opt/circleci/.pyenv" >> $BASH_ENV
echo "export PATH=$PYENV_ROOT/bin:$PYENV_ROOT/libexec:/home/circleci/.local/bin:/home/circleci/cmake-3.17.0-Linux-x86_64/bin:$PATH" >> $BASH_ENV
echo "export LD_LIBRARY_PATH=/home/circleci/.local/lib:$LD_LIBRARY_PATH" >> $BASH_ENV
source $BASH_ENV
- checkout
- run:
name: Switch to Python v3.7
command: |
pyenv versions
pyenv global 3.7.0
pyenv versions
- restore_cache:
keys:
- blocksci-deps-{{ .Branch }}-{{ .BuildNum }}
- blocksci-deps-{{ .Branch }}
- blocksci-deps-
- run:
name: Install Packages (C++)
command: .circleci/build_ubuntu_cpp.sh
- save_cache:
paths:
- /home/circleci/cmake-3.17.0-Linux-x86_64/
key: blocksci-deps-{{ .Branch }}-{{ .BuildNum }}
- restore_cache:
keys:
- blocksci-{{ .Branch }}-
- blocksci-
- run:
name: Compile BlockSci (C++)
command: .circleci/compile_ubuntu_cpp.sh
- save_cache:
paths:
- release/
- /home/circleci/.local
- .mtime_cache/
key: blocksci-{{ .Branch }}-{{ epoch }}
- run:
name: Test Parser Functionality
command: .circleci/test_parser.sh
- restore_cache:
keys:
- blockscipy-{{ .Branch }}-
- blockscipy-
- run:
name: Install Packages (Python)
command: .circleci/build_ubuntu_python.sh
- run:
name: Compile BlockSciPy (Python)
command: .circleci/compile_ubuntu_python.sh
- save_cache:
paths:
- blockscipy/build
key: blockscipy-{{ .Branch }}-{{ epoch }}
- run:
name: Run Tests
command: .circleci/test_python.sh
- store_test_results:
path: test/test-results
- store_artifacts:
path: test/test-results
15 changes: 15 additions & 0 deletions .circleci/test_parser.sh
@@ -0,0 +1,15 @@
set -ev
cd test
blocksci_parser btc.json generate-config bitcoin_regtest bitcoin_regtest --disk files/btc/regtest/
blocksci_parser btc.json doctor
blocksci_parser btc.json update
blocksci_check_integrity btc.json
blocksci_parser bch.json generate-config bitcoin_cash_regtest bitcoin_cash_regtest --disk files/bch/regtest/
blocksci_parser bch.json doctor
blocksci_parser bch.json update
blocksci_check_integrity bch.json
blocksci_parser ltc.json generate-config litecoin_regtest litecoin_regtest --disk files/ltc/regtest/
blocksci_parser ltc.json doctor
blocksci_parser ltc.json update
blocksci_check_integrity ltc.json
cd ..
7 changes: 7 additions & 0 deletions .circleci/test_python.sh
@@ -0,0 +1,7 @@
set -ev
cd test
mkdir test-results
cd blockscipy
pytest -v --junitxml=../test-results/junit.xml
cd ../benchmark
./new-benchmark.sh
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,6 +1,6 @@
[submodule "libs/pybind11"]
path = blockscipy/blocksci/pybind11
url = https://github.com/pybind/pybind11/
url = https://github.com/pybind/pybind11
[submodule "libs/bitcoin-api-cpp"]
path = external/bitcoin-api-cpp
url = https://github.com/hkalodner/bitcoin-api-cpp.git
Expand Down

0 comments on commit 4b361a9

Please sign in to comment.