mirror of https://github.com/nucypher/nucypher.git
Merge pull request #336 from KPrasch/coffee
Update Pipfile Specifications; Simplify Build; Add checkspull/344/head
commit
d4a9779903
|
@ -5,12 +5,12 @@ workflows:
|
|||
test:
|
||||
jobs:
|
||||
- bundle_dependencies-36
|
||||
- contract_unit:
|
||||
- mypy_type_check:
|
||||
requires:
|
||||
- bundle_dependencies-36
|
||||
- intercontract_integration:
|
||||
- eth_contract_unit:
|
||||
requires:
|
||||
- contract_unit
|
||||
- bundle_dependencies-36
|
||||
- crypto_unit:
|
||||
requires:
|
||||
- bundle_dependencies-36
|
||||
|
@ -20,7 +20,7 @@ workflows:
|
|||
- keystore_unit:
|
||||
requires:
|
||||
- bundle_dependencies-36
|
||||
- blockchain_client_unit:
|
||||
- blockchain_interface_unit:
|
||||
requires:
|
||||
- bundle_dependencies-36
|
||||
- character:
|
||||
|
@ -28,44 +28,49 @@ workflows:
|
|||
- crypto_unit
|
||||
- network_unit
|
||||
- keystore_unit
|
||||
- intercontract_integration:
|
||||
requires:
|
||||
- eth_contract_unit
|
||||
|
||||
bundle_dependencies: &bundle_dependencies
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Install Python dependencies with Pipenv
|
||||
command: |
|
||||
pipenv install --three --dev --skip-lock
|
||||
- run:
|
||||
name: Install Solidity compiler
|
||||
command: |
|
||||
wget "https://github.com/ethereum/solidity/releases/download/${SOLC_VER}/solc-static-linux" -O "$(pipenv --venv)/bin/solc"
|
||||
chmod +x "$(pipenv --venv)/bin/solc"
|
||||
environment:
|
||||
SOLC_VER: "v0.4.24"
|
||||
- save_cache:
|
||||
paths:
|
||||
- "~/.local/share/virtualenvs/"
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
python_36_base: &python_36_base
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
|
||||
jobs:
|
||||
bundle_dependencies-36:
|
||||
<<: *bundle_dependencies
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Python Dependencies with Pipenv
|
||||
command: |
|
||||
pipenv install --three --dev --pre --skip-lock
|
||||
- run:
|
||||
name: Install Solidity Compiler
|
||||
command: pipenv run install_solc
|
||||
- save_cache:
|
||||
paths:
|
||||
- "~/.local/share/virtualenvs/"
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
|
||||
contract_unit:
|
||||
parallelism: 4
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
blockchain_interface_unit:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Blockchain Interface Tests
|
||||
command: pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow tests/blockchain/eth/interfaces tests/blockchain/eth/entities
|
||||
|
||||
eth_contract_unit:
|
||||
<<: *python_36_base
|
||||
parallelism: 4
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Ethereum Contract Unit Tests
|
||||
command: |
|
||||
|
@ -73,81 +78,65 @@ jobs:
|
|||
- store_test_results:
|
||||
path: ./reports/pytest/
|
||||
|
||||
|
||||
intercontract_integration:
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
crypto_unit:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Crypto Character Tests
|
||||
command: pipenv run pytest --cov=nucypher/crypto -v --runslow tests/crypto
|
||||
|
||||
network_unit:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Network Tests
|
||||
command: pipenv run pytest --cov=nucypher/network -v --runslow tests/network
|
||||
|
||||
keystore_unit:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Keystore Tests
|
||||
command: pipenv run pytest --cov=nucypher/keystore -v --runslow tests/keystore
|
||||
|
||||
character:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Character Tests
|
||||
command: pipenv run pytest --cov=nucypher/characters -v --runslow tests/characters
|
||||
|
||||
intercontract_integration:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Ethereum Inter-Contract Integration Test
|
||||
command: |
|
||||
pipenv run pytest -v --runslow tests/blockchain/eth/contracts/integration
|
||||
|
||||
crypto_unit:
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
mypy_type_check:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
key: v1-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Crypto Character Tests
|
||||
command: |
|
||||
pipenv run pytest --cov=nucypher/crypto -v --runslow tests/crypto
|
||||
|
||||
network_unit:
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Network Tests
|
||||
command: |
|
||||
pipenv run pytest --cov=nucypher/network -v --runslow tests/network
|
||||
|
||||
keystore_unit:
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Keystore Tests
|
||||
command: |
|
||||
pipenv run pytest --cov=nucypher/keystore -v --runslow tests/keystore
|
||||
|
||||
character:
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Character Tests
|
||||
command: |
|
||||
pipenv run pytest --cov=nucypher/characters -v --runslow tests/characters
|
||||
|
||||
blockchain_client_unit:
|
||||
working_directory: ~/nucypher-depends
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: v2-deps-{{ .Branch }}-{{ checksum "Pipfile" }}
|
||||
- run:
|
||||
name: Blockchain Client Tests
|
||||
command: |
|
||||
pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow tests/blockchain/eth/interfaces tests/blockchain/eth/entities
|
||||
name: Run Mypy Static Type Checks
|
||||
command: pipenv run mypy --xslt-html-report ./mypy_report ./nucypher --config-file=mypy.ini
|
||||
- store_artifacts:
|
||||
path: ./mypy_report
|
||||
|
|
18
.travis.yml
18
.travis.yml
|
@ -1,18 +0,0 @@
|
|||
language: python
|
||||
cache: pip
|
||||
python:
|
||||
- '3.5'
|
||||
- '3.6'
|
||||
- '3.7'
|
||||
install:
|
||||
- pip install pipenv --upgrade
|
||||
- pipenv install --dev --three
|
||||
before_script:
|
||||
- wget https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux -O "${VIRTUAL_ENV}/bin/solc"
|
||||
- chmod +x "${VIRTUAL_ENV}/bin/solc"
|
||||
script:
|
||||
- pipenv run -- pytest --runslow --cov=nucypher -v tests
|
||||
- codecov
|
||||
matrix:
|
||||
allow_failures:
|
||||
- python: '3.7'
|
35
Pipfile
35
Pipfile
|
@ -3,30 +3,27 @@ url = "https://pypi.python.org/simple"
|
|||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
|
||||
[packages]
|
||||
# Wheels for cryptography until the next release.
|
||||
|
||||
# Wheels for cryptography until the next release
|
||||
cryptography35_linux = { path='./wheelhouse/cryptography-2.3.dev1-cp35-cp35m-linux_x86_64.whl', markers="python_version >= '3.5' and python_version < '3.6' and platform_system == 'Linux'"}
|
||||
cryptography36_linux = { path='./wheelhouse/cryptography-2.3.dev1-cp36-cp36m-linux_x86_64.whl', markers="python_version >= '3.6' and python_version < '3.7' and platform_system == 'Linux'"}
|
||||
cryptography36_darwin = { path='./wheelhouse/cryptography-2.3.dev1-cp36-cp36m-macosx_10_13_x86_64.whl', markers="python_version >= '3.6' and python_version < '3.7' and platform_system == 'Darwin'"}
|
||||
|
||||
|
||||
rpcudp = {git = "https://github.com/nucypher/rpcudp", ref = "nucypher-depend"}
|
||||
kademlia = {git = "https://github.com/nucypher/kademlia", ref = "nucypher-depend"}
|
||||
PyNaCl = "*"
|
||||
"pysha3" = "*"
|
||||
bidict = "*"
|
||||
py_ecc = "*"
|
||||
SQLAlchemy = "*"
|
||||
apistar = "*"
|
||||
maya = "*"
|
||||
pyumbral = {git = "https://github.com/nucypher/pyumbral.git", ref = "nucypher-depend"}
|
||||
requests = "*"
|
||||
maya = "*"
|
||||
hendrix = "==3.0.0"
|
||||
constantSorrow = {git = "https://github.com/nucypher/constantSorrow.git", ref = "nucypher-depend"}
|
||||
bytestringSplitter = {git = "https://github.com/nucypher/byteStringSplitter.git", ref = "nucypher-depend"}
|
||||
appdirs = "*"
|
||||
web3 = "==4.3.0"
|
||||
sqlalchemy = "*"
|
||||
apistar = "*"
|
||||
rpcudp = {git = "https://github.com/nucypher/rpcudp", ref = "nucypher-depend"}
|
||||
kademlia = {git = "https://github.com/nucypher/kademlia", ref = "nucypher-depend"}
|
||||
pynacl = "*"
|
||||
pysha3 = "*"
|
||||
py_ecc = "*"
|
||||
pyumbral = {git = "https://github.com/nucypher/pyumbral.git", ref = "nucypher-depend"}
|
||||
web3 = "*"
|
||||
|
||||
[dev-packages]
|
||||
pytest = "*"
|
||||
|
@ -36,9 +33,11 @@ codecov = "*"
|
|||
coverage = "*"
|
||||
pytest-cov = "*"
|
||||
py-solc = "*"
|
||||
py-evm = "==0.2.0a18"
|
||||
eth-tester = "==0.1.0b26"
|
||||
py-geth = "*"
|
||||
py-evm = "*"
|
||||
eth-tester = "*"
|
||||
|
||||
[pipenv]
|
||||
allow_prereleases = true
|
||||
|
||||
[scripts]
|
||||
install_solc = "scripts/install_solc.sh"
|
||||
|
|
7
mypy.ini
7
mypy.ini
|
@ -1,2 +1,7 @@
|
|||
[mypy]
|
||||
ignore_missing_imports=True
|
||||
python_version=3.6
|
||||
verbosity=0
|
||||
[mypy-nucypher.*]
|
||||
disallow_untyped_defs=True
|
||||
check_untyped_defs=False
|
||||
disallow_untyped_calls=True
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
SOLC_VER="0.4.24"
|
||||
SOL_BIN_PATH="$(pipenv --venv)/bin/solc"
|
||||
|
||||
echo "Downloading solidity compiler binary to: ${SOL_BIN_PATH}"
|
||||
wget "https://github.com/ethereum/solidity/releases/download/v${SOLC_VER}/solc-static-linux" -O ${SOL_BIN_PATH}
|
||||
echo "Setting executable permission on ${SOL_BIN_PATH}"
|
||||
chmod +x ${SOL_BIN_PATH}
|
||||
echo "Successfully Installed solc ${SOLC_VER}"
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# The following line is needed by the CircleCI Local Build Tool (due to Docker interactivity)
|
||||
exec < /dev/tty
|
||||
|
||||
echo "Validating CircleCI YML Config..."
|
||||
# If validation fails, tell Git to stop and provide error message. Otherwise, continue.
|
||||
if ! eMSG=$(circleci config validate -c .circleci/config.yml); then
|
||||
echo "CircleCI Configuration Failed Validation."
|
||||
echo $eMSG
|
||||
exit 1
|
||||
fi
|
||||
echo "CircleCI config is valid."
|
16
setup.sh
16
setup.sh
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PYTHON="python3.6"
|
||||
SOLC_VER="0.4.24"
|
||||
|
||||
python3 -m pipenv > /dev/null
|
||||
if [[ $? != 0 ]]
|
||||
then
|
||||
echo "Installing pipenv in user directory..."
|
||||
pip3 install --user pipenv
|
||||
fi
|
||||
|
||||
python3 -m pipenv install --python $PYTHON --dev
|
||||
wget "https://github.com/ethereum/solidity/releases/download/v${SOLC_VER}/solc-static-linux" -O "$(pipenv --venv)/bin/solc"
|
||||
chmod +x "$(pipenv --venv)/bin/solc"
|
||||
pipenv run pip3 install -e .
|
|
@ -1,17 +1,11 @@
|
|||
import contextlib
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
import shutil
|
||||
import time
|
||||
from constant_sorrow import constants
|
||||
from eth_tester import EthereumTester
|
||||
from geth import LoggingMixin, DevGethProcess
|
||||
from os.path import abspath, dirname
|
||||
from web3 import EthereumTesterProvider, IPCProvider
|
||||
from web3 import EthereumTesterProvider
|
||||
|
||||
from nucypher.blockchain.eth.chains import TesterBlockchain
|
||||
from nucypher.blockchain.eth.deployers import PolicyManagerDeployer, NucypherTokenDeployer, MinerEscrowDeployer
|
||||
|
@ -26,82 +20,6 @@ constants.NUMBER_OF_TEST_ETH_ACCOUNTS(10)
|
|||
|
||||
|
||||
|
||||
#
|
||||
# Provider Fixtures
|
||||
#
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def manual_geth_ipc_provider():
|
||||
"""
|
||||
Provider backend
|
||||
https:// github.com/ethereum/eth-tester
|
||||
"""
|
||||
ipc_provider = IPCProvider(ipc_path='/tmp/geth.ipc')
|
||||
yield ipc_provider
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def auto_geth_dev_ipc_provider():
|
||||
"""
|
||||
Provider backend
|
||||
https:// github.com/ethereum/eth-tester
|
||||
"""
|
||||
# TODO: logging
|
||||
geth_cmd = ["geth --dev"] # WARNING: changing this may have undesireable effects.
|
||||
geth_process = subprocess.Popen(geth_cmd, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)
|
||||
|
||||
time.sleep(10) #TODO: better wait with file socket
|
||||
|
||||
ipc_provider = IPCProvider(ipc_path=os.path.join('/tmp/geth.ipc'))
|
||||
|
||||
yield ipc_provider
|
||||
os.killpg(os.getpgid(geth_process.pid), signal.SIGTERM)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def auto_geth_ipc_provider():
|
||||
"""
|
||||
Provider backend
|
||||
https: // github.com / ethereum / eth - tester # available-backends
|
||||
"""
|
||||
|
||||
#
|
||||
# spin-up geth
|
||||
#
|
||||
|
||||
class IPCDevGethProcess(LoggingMixin, DevGethProcess):
|
||||
data_dir = tempfile.mkdtemp()
|
||||
chain_name = 'tester'
|
||||
ipc_path = os.path.join(data_dir, chain_name, 'geth.ipc')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(chain_name=self.chain_name,
|
||||
base_dir=self.data_dir,
|
||||
*args, **kwargs)
|
||||
|
||||
geth = IPCDevGethProcess()
|
||||
geth.start()
|
||||
|
||||
geth.wait_for_ipc(timeout=30)
|
||||
geth.wait_for_dag(timeout=600) # 10 min
|
||||
assert geth.is_dag_generated
|
||||
assert geth.is_running
|
||||
assert geth.is_alive
|
||||
|
||||
ipc_provider = IPCProvider(ipc_path=geth.ipc_path)
|
||||
yield ipc_provider
|
||||
|
||||
#
|
||||
# Teardown
|
||||
#
|
||||
geth.stop()
|
||||
assert geth.is_stopped
|
||||
assert not geth.is_alive
|
||||
shutil.rmtree(geth.data_dir)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Blockchain
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue