Skip to content

Commit

Permalink
merges vcx-ci with evernym indy-sdk fork (hyperledger-archives#15)
Browse files Browse the repository at this point in the history
* merges vcx-ci with evernym indy-sdk fork

Signed-off-by: Ryan Marsh <ryan.marsh44@gmail.com>

* accepts libindy 1.7.0~942

Signed-off-by: Ryan Marsh <ryan.marsh44@gmail.com>
  • Loading branch information
rytmarsh authored and nsivraj committed Jan 23, 2019
1 parent 9544a03 commit 86dcbbc
Show file tree
Hide file tree
Showing 37 changed files with 563 additions and 213 deletions.
253 changes: 159 additions & 94 deletions vcx/ci/Jenkinsfile

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions vcx/ci/change_toml_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,6 @@ def change_version(v, b, h):
s = s + "+" + str(h)
return s


# for testing
#def test():

#version = "1.2.33346324+cd3sd2fe"
#build = "45678910"
#h = 'beefb23'
#print("before: %s" % version)
#version = change_version(version, build, h)
#print("after: %s" % version)

# version = "2.3"
# print("before: %s" % version)
# version = change_version(version, build, h)
# print("after: %s" % version)
#
# print('parsing version "version = 1.2.3"')
# print(parse_version("version=1.2.3"))
#
# version = "1.2.3.hasbas"
# print("testing truncate on %s" % version)
# print('truncated: %s ' % truncate(version))


# parses out the vesion number from a given
# line (pulled from the Cargo.toml file)
def parse_version(s):
Expand All @@ -104,6 +80,3 @@ def parse_version(s):
print("PATH = path to Cargo.toml file")
print("BUILD_NUM = build number for version")
print("HASH_NUM = commit hash for version")


# not used
22 changes: 22 additions & 0 deletions vcx/ci/copyNoClobber.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

if [ $# -ne "1" ]; then
echo USAGE: `basename "$0"` INDY_DIR
exit 1
elif [ ! -e $INDY ]; then
echo "Incorrect Indy Location"
fi

INDY=$1

ls -al
ls -alr vcx/*
ls -alr vcx/libvcx/*


cp -rn $INDY/vcx/* vcx
mkdir -p wrappers/rust
cp -rn $INDY/wrappers/rust/* wrappers/rust
ls -al
ls -alr vcx/*
ls -alr vcx/libvcx/*
11 changes: 6 additions & 5 deletions vcx/ci/libindy.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ RUN apt-get update -y && apt-get install -y \
libsodium-dev \
libssl-dev \
libgmp3-dev \
build-essential \
libsqlite3-dev \
libsqlite0 \
cmake \
Expand All @@ -20,10 +19,9 @@ RUN apt-get update -y && apt-get install -y \
wget \
git \
curl \
libffi-dev \
libffi-dev \
ruby \
ruby-dev \
sudo \
rubygems \
libzmq5 \
python3 \
Expand All @@ -34,14 +32,14 @@ RUN apt-get update -y && apt-get install -y \
libzmq3-dev \
zip \
unzip \
vim
sudo

# Install Nodejs
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs

# Install Rust
ARG RUST_VER="1.31.0"
ARG RUST_VER
ENV RUST_ARCHIVE=rust-${RUST_VER}-x86_64-unknown-linux-gnu.tar.gz
ENV RUST_DOWNLOAD_URL=https://static.rust-lang.org/dist/$RUST_ARCHIVE

Expand All @@ -66,9 +64,12 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88 && \
add-apt-repository 'deb https://repo.corp.evernym.com/deb evernym-agency-dev-ubuntu main' && \
curl https://repo.corp.evernym.com/repo.corp.evenym.com-sig.key | apt-key add -

# these are default values if they are not passed into the environment with
# the --build-arg flag from 'docker build' command.
ARG LIBINDY_VER="1.7.0"
ARG LIBNULL_VER="1.7.0"

ARG LIBSOVTOKEN_VER="0.9.6~-1.126"
RUN apt-get update && apt-get install -y \
libindy=${LIBINDY_VER} \
libnullpay=${LIBNULL_VER}
3 changes: 2 additions & 1 deletion vcx/ci/libvcx.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ ARG uid=1000
RUN useradd -ms /bin/bash -u $uid vcx
USER vcx

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.31.0
ARG RUST_VER
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_VER}
ENV PATH /home/vcx/.cargo/bin:$PATH
WORKDIR /home/vcx
ENV PATH /home/vcx:$PATH
Expand Down
16 changes: 16 additions & 0 deletions vcx/ci/python.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM libindy
ARG uid=1000
RUN useradd -ms /bin/bash -u $uid python

RUN apt-get update && apt-get install -y python3

RUN apt-get install -y python3-pip

RUN pip3 install pytest==4.1.0 qrcode pytest-asyncio

ENV PYTHONPATH=vcx/wrappers/python3

RUN find . -name \*.pyc -delete
COPY vcx/libvcx/target/debian/*.deb .
RUN dpkg -i *.deb
USER python
74 changes: 62 additions & 12 deletions vcx/ci/scripts/androidBuild.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

setup() {
echo "Working Directory: ${PWD}"
set -e
Expand All @@ -8,6 +10,7 @@ setup() {
export PATH=$PATH:/opt/gradle/gradle-3.4.1/bin
export PATH=${PATH}:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools/25.0.2/
export PATH=${HOME}/.cargo/bin:${PATH}
export SOVRIN_REPO=https://repo.sovrin.org/android/libsovtoken/stable
export VCX_BASE=../vcx
# For docker
# export VCX_BASE=${HOME}/vcx
Expand Down Expand Up @@ -56,7 +59,7 @@ retrieve_prebuilt_binaries() {

generate_flags(){
if [ -z $1 ]; then
echo "please provide the arch e.g arm, x86 or arm64"
echo "please provide the arch e.g arm, arm64, armv7, x86, or x86_64"
exit 1
fi
if [ $1 == "arm" ]; then
Expand All @@ -75,14 +78,13 @@ generate_flags(){
export ARCH="x86"
export TRIPLET="i686-linux-android"
export PLATFORM="16"
export ABI="x86"
fi

if [ $1 == "arm64" ]; then
export ARCH="arm64"
export TRIPLET="aarch64-linux-android"
elif [ $1 == "x86_64" ]; then
export ARCH="x86_64"
export TRIPLET="x86_64-linux-android"
export PLATFORM="21"
export ABI="arm64-v8a"
else
echo "please provide the arch e.g arm, arm64, armv7, x86, or x86_64"
exit 1
fi
}

Expand All @@ -91,22 +93,60 @@ get_libindy() {
if [ -z ${LIBINDY_DIR} ]; then
[ -z ${LIBINDY_BRANCH} ] && exit 1
[ -z ${LIBINDY_VERSION} ] && exit 1

SIMPLE_LIBINDY_VERSION=$(echo ${LIBINDY_VERSION} | cut -f1 -d'-')
if [ ! -d "libindy_${ARCH}" ]; then

if [ "$LIBINDY_BRANCH" = "stable" ]; then
wget https://repo.sovrin.org/android/libindy/${LIBINDY_BRANCH}/${LIBINDY_VERSION}/libindy_android_${ARCH}_${LIBINDY_VERSION}.zip
else
wget https://repo.sovrin.org/android/libindy/${LIBINDY_BRANCH}/${LIBINDY_VERSION}-${LIBINDY_TAG}/libindy_android_${ARCH}_${LIBINDY_VERSION}.zip
wget https://repo.sovrin.org/android/libindy/${LIBINDY_BRANCH}/1.7.0-934/libindy_android_${ARCH}_${SIMPLE_LIBINDY_VERSION}.zip
fi

unzip libindy_android_${ARCH}_${LIBINDY_VERSION}.zip
unzip libindy_android_${ARCH}_${SIMPLE_LIBINDY_VERSION}.zip

fi
export LIBINDY_DIR="${PWD}/libindy_${ARCH}"
fi

}

get_libsovtoken() {
set -xv
# Todo: This artifact was manually uploaded to this repo. Eventually, the file format will change. That is why it is hardcoded
if [ -z ${LIBSOVTOKEN_DIR} ]; then
LIBSOVTOKEN_ZIP=libsovtoken_0.9.6-201811211720-4901e95_all.zip
if [ ! -d "libsovtoken" ]; then
echo "retrieving libsovtoken prebuilt library"
wget ${SOVRIN_REPO}/${LIBSOVTOKEN_ZIP}
unzip ${LIBSOVTOKEN_ZIP}
fi
export LIBSOVTOKEN_DIR="${PWD}/libsovtoken/${TRIPLET}"
fi

}

get_libnullpay() {
set -xv
if [ -z ${LIBNULLPAY_DIR} ]; then
[ -z ${LIBINDY_BRANCH} ] && exit 1
[ -z ${LIBINDY_VERSION} ] && exit 1
SIMPLE_LIBINDY_VERSION=$(echo ${LIBINDY_VERSION} | cut -f1 -d'-')
if [ ! -d "libnullpay_${ARCH}" ]; then

if [ "$LIBINDY_BRANCH" = "stable" ]; then
wget https://repo.sovrin.org/android/libnullpay/${LIBINDY_BRANCH}/${LIBINDY_VERSION}/libnullpay_android_${ARCH}_${LIBINDY_VERSION}.zip
else
wget https://repo.sovrin.org/android/libnullpay/${LIBINDY_BRANCH}/1.7.0-934/libnullpay_android_${ARCH}_${SIMPLE_LIBINDY_VERSION}.zip
fi

unzip libnullpay_android_${ARCH}_${SIMPLE_LIBINDY_VERSION}.zip

fi
export LIBNULLPAY_DIR="${PWD}/libnullpay_${ARCH}"
fi

}

build_vcx() {
# For Jenkins
LIBVCX_PATH=${VCX_BASE}/libvcx/build_scripts/android/vcx/
Expand All @@ -119,10 +159,18 @@ build_vcx() {
echo "missing libindy_${ARCH} directory. Cannot proceed without it."
exit 1
fi
if [ ! -d ${LIBSOVTOKEN_DIR} ]; then
echo "missing libsovtoken directory. Cannot proceed without it."
exit 1
fi
if [ ! -d ${LIBNULLPAY_DIR} ]; then
echo "missing libnullpay directory. Cannot proceed without it."
exit 1
fi

pushd ${LIBVCX_PATH}
mkdir -p toolchains/
./build.nondocker.sh ${ARCH} ${PLATFORM} ${TRIPLET} ${OPENSSL_DIR} ${SODIUM_DIR} ${LIBZMQ_DIR} ${LIBINDY_DIR}
./build.nondocker.sh ${ARCH} ${PLATFORM} ${TRIPLET} ${OPENSSL_DIR} ${SODIUM_DIR} ${LIBZMQ_DIR} ${LIBINDY_DIR} ${LIBSOVTOKEN_DIR} ${LIBNULLPAY_DIR}
popd
rm -rf libvcx_${ARCH}
mv ${LIBVCX_PATH}libvcx_${ARCH} .
Expand All @@ -131,4 +179,6 @@ build_vcx() {

setup $1
get_libindy $1
get_libsovtoken
get_libnullpay
build_vcx $1
47 changes: 39 additions & 8 deletions vcx/ci/scripts/iosBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,43 @@
set -e
export SCRIPTS_PATH="vcx/libvcx/build_scripts/ios/mac"
export BASE_DIR="../../../../.."
export WRAPPER_BASE="vcx/wrappers/ios/vcx"
export WRAPPER_LIBS="vcx/wrappers/ios/vcx/lib"
IOS_TARGETS="aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios"
#IOS_TARGETS="x86_64-apple-ios"
IOS_ARCHS="arm64,armv7,armv7s,i386,x86_64"
#IOS_ARCHS="x86_64"
IOS_TARGETS="aarch64-apple-ios,armv7-apple-ios,i386-apple-ios,x86_64-apple-ios"
IOS_ARCHS="arm64,armv7,i386,x86_64"
#IOS_TARGETS="x86_64-apple-ios,i386-apple-ios"
#IOS_ARCHS="x86_64,i386"


function printStartProgress {
echo "=================="
echo "Starting"
echo $1
echo "=================="
echo
}

function printEndProgress {
echo
echo "+++++++++++++++++"
echo "Finished"
echo $1
echo "+++++++++++++++++"
}

function progress {
printStartProgress $1
$1
printEndProgress $1
}

cd ${SCRIPTS_PATH}
./mac.01.libindy.setup.sh
./mac.02.libindy.env.sh
./mac.03.libindy.build.sh

progress ./mac.01.libindy.setup.sh
progress ./mac.02.libindy.env.sh
progress ./mac.03.libindy.build.sh
#./mac.04.libvcx.setup.sh
source ./mac.05.libvcx.env.sh
progress 'source ./mac.05.libvcx.env.sh'
cp -rf ~/OpenSSL-for-iPhone ${BASE_DIR}/.macosbuild
cp -rf ~/libzmq-ios ${BASE_DIR}/.macosbuild
cp -rf ~/combine-libs ${BASE_DIR}/.macosbuild
Expand All @@ -30,6 +55,12 @@ if [ ! -z "$(ls -A /Users/jenkins/IOSBuilds/libvcxall/)" ]; then
rm /Users/jenkins/IOSBuilds/libvcxall/*
fi

# Retrieve libindy ios wrapper
#git clone https://github.com/hyperledger/indy-sdk.git
#cd indy-sdk
#git checkout tags/v1.7.0
#cd ..
#cp -rf indy-sdk/wrappers/ios/libindy-pod/Indy ${WRAPPER_BASE}
# Package for all architectures (simulator architectures included)
./mac.11.copy.static.libs.to.app.sh
./mac.12.combine.static.libs.sh libvcxall delete nodebug "${IOS_ARCHS}"
Expand Down
14 changes: 13 additions & 1 deletion vcx/ci/scripts/package.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
#!/bin/bash
set -e
OUTPUTDIR=output
CURDIR=$(pwd)
export PATH=${PATH}:$(pwd)/vcx/ci/scripts
cd vcx/libvcx/
echo "Updating Version in Cargo.toml file"
cargo update-version
cargo test --no-default-features --features "ci" -- --test-threads=1
echo "Updating Cargo"
if [ "$1" != "--no-test" ]; then
echo "Testing libvcx.so"
cargo test --no-default-features --features "ci" -- --test-threads=1
fi
echo "Building libvcx.so"
cargo build --no-default-features --features "ci"
echo "Updating libvcx.so File with Version"
cargo update-so
echo "Creating Libvcx Debian File"
cargo deb --no-build
echo "Moving Libvcx Debian File to Output Directory"
cp target/debian/*.deb $CURDIR/$OUTPUTDIR


2 changes: 1 addition & 1 deletion vcx/ci/scripts/toml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SO_FILE = 'libvcx.so'

def valid_line(line):
return ('version =' in line or 'version=' in line) and ('uuid' not in line and 'rusqlite' not in line)
return ('version =' in line or 'version=' in line) and ('uuid' not in line and 'rusqlite' not in line and 'indy' not in line)

# update the so file with the major minor build
def update_so(src_dir, version):
Expand Down
2 changes: 1 addition & 1 deletion vcx/libvcx/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 86dcbbc

Please sign in to comment.