contract-registry

Ethereum Smart Contract key-value registry
Log | Files | Refs

commit 3e35a8b32aa5fd615ee696f62b7cf9518070203d
parent e5f3acc3e396a19c1cdc7137382bd3190318e984
Author: Idaapayo <idaapayo@gmail.com>
Date:   Sun, 20 Feb 2022 19:46:58 +0000

Ida/ci test

Diffstat:
M.gitignore | 3+++
A.gitlab-ci.yml | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apython/.coverage | 0
Apython/.coveragerc | 7+++++++
Mpython/tests/test_basic.py | 2+-
5 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore @@ -4,3 +4,5 @@ dist/ gmon.out __pycache__ *.pyc +venv +.idea +\ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml @@ -0,0 +1,58 @@ +stages: + - test + - run-coverage + - slither-analyzer + + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + - .cache/pip + - .venv/ + +before_script: + - python -V # Print out python version for debugging + - pip install virtualenv + - virtualenv venv + - source venv/bin/activate + +test: + image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest + script: + # install test dependencies + - cd python + - export PYTHONPATH=. + - pip install --extra-index-url https://pip.grassrootseconomics.net + --extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple + -r requirements.txt -r test_requirements.txt + # run tests + - bash run_tests.sh + +run-coverage: + stage: test + image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest + script: + - cd python + - export PYTHONPATH=. + - pip install --extra-index-url https://pip.grassrootseconomics.net + --extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple + -r requirements.txt -r test_requirements.txt + - pip install pytest pytest-cov + - coverage run -m pytest + - coverage html + - coverage report --fail-under=90 + + coverage: '/^TOTAL.+?(\d+\%)$/' + artifacts: + reports: + cobertura: python/htmlcov/index.html + +slither-analyzer: + image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-python:latest + allow_failure: true + script: + - cd solidity + - slither Registry.sol + - slither Registry.sol --print human-summary diff --git a/python/.coverage b/python/.coverage Binary files differ. diff --git a/python/.coveragerc b/python/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = eth_contract_registry +[report] +omit = .venv/* + **/runnable/*.py +[html] diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -52,7 +52,7 @@ def test_set( o = builder.address_of(registry, 'ContractRegistry', sender_address=eth_accounts[0]) r = eth_rpc.do(o) r = abi_decode_single(ABIContractType.ADDRESS, r) - assert r == registry + assert r == strip_0x(registry) (tx_hash_hex, o) = builder.set(registry, roles['CONTRACT_DEPLOYER'], 'ContractRegistry', addr_registry) r = eth_rpc.do(o)