Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #134 from Artemkaaas/feature/python-pipeline
Browse files Browse the repository at this point in the history
Added jenkins pipeline for python wrapper
  • Loading branch information
Vyacheslav authored Jul 27, 2017
2 parents a614481 + 27584a3 commit 921fa53
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ Cargo.lock
.venv
.cache
.DS_Store
Podfile.lock

Podfile.lock
28 changes: 28 additions & 0 deletions ci/python.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:16.04

ARG uid=1000

RUN apt-get update && \
apt-get install -y \
gdebi \
apt-utils \
software-properties-common

RUN add-apt-repository ppa:jonathonf/python-3.6

RUN apt-get update && \
apt-get install -y \
python3.6 \
python3-pip

ADD https://repo.evernym.com/deb/indy-sdk/0.1.1/indy-sdk_0.1.1_amd64.deb .

RUN gdebi -n indy-sdk_0.1.1_amd64.deb

RUN useradd -ms /bin/bash -u $uid indy
USER indy

WORKDIR /home/indy



1 change: 1 addition & 0 deletions wrappers/python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
91 changes: 91 additions & 0 deletions wrappers/python/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!groovy​

@Library('SovrinHelpers') _

name = 'indy-sdk'
def err
def publishBranch = (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel')

try {

// ALL BRANCHES: master, devel, PRs

// 1. TEST
stage('Test') {
parallel 'ubuntu-python-test': {
node('ubuntu') {
stage('Ubuntu Python Test') {
pythonTestUbuntu()
}
}
}
}

} catch (e) {
currentBuild.result = "FAILED"
node('ubuntu-master') {
sendNotification.fail([slack: publishBranch])
}
err = e
} finally {
if (err) {
throw err
}
currentBuild.result = "SUCCESS"
if (publishBranch) {
node('ubuntu-master') {
sendNotification.success(name)
}
}
}

def pythonTestUbuntu() {
def poolInst
def network_name = "pool_network"
try {
echo 'Ubuntu Python Test: Checkout csm'
checkout scm

echo "Ubuntu Python Test: Create docker network (${network_name}) for nodes pool and test image"
sh "docker network create --subnet=10.0.0.0/8 ${network_name}"

echo 'Ubuntu Python Test: Build docker image for nodes pool'
def poolEnv = dockerHelpers.build('indy_pool', 'ci/indy-pool.dockerfile ci')
echo 'Ubuntu Python Test: Run nodes pool'
poolInst = poolEnv.run("--ip=\"10.0.0.2\" --network=${network_name}")

echo 'Ubuntu Python Test: Build docker image'
def testEnv = dockerHelpers.build(name, 'ci/python.dockerfile ci')

testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo 'Ubuntu Python Test: Test'

sh '''
cd wrappers/python
python3.6 -m pip install -e .
python3.6 -m pytest
'''
}
}
finally {
echo "Ubuntu Python Test: Cleanup"
try {
sh "docker network inspect ${network_name}"
} catch (err) {
echo "Ubuntu Python Tests: error while inspect network ${network_name} - ${err}"
}
try {
echo "Ubuntu Python Test: stop pool"
poolInst.stop()
} catch (err) {
echo "Ubuntu Python Tests: error while stop pool ${err}"
}
try {
echo "Ubuntu Python Test: remove pool network ${network_name}"
sh "docker network rm ${network_name}"
} catch (err) {
echo "Ubuntu Python Test: error while delete ${network_name} - ${err}"
}
step([$class: 'WsCleanup'])
}
}
2 changes: 1 addition & 1 deletion wrappers/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
author='Vyacheslav Gudkov',
author_email='vyacheslav.gudkov@dsr-company.com',
description='This is the official SDK for Hyperledger Indy (https://www.hyperledger.org/projects), which provides a distributed-ledger-based foundation for self-sovereign identity (https://sovrin.org). The major artifact of the SDK is a c-callable library.',
install_requires=[],
install_requires=['pytest', 'pytest-asyncio', 'base58'],
tests_require=['pytest', 'pytest-asyncio', 'base58']
)

0 comments on commit 921fa53

Please sign in to comment.