From a45672775f1698084e05c3dffb5c2ec1c4eb2411 Mon Sep 17 00:00:00 2001 From: Idaapayo Date: Sun, 20 Feb 2022 19:47:16 +0000 Subject: [PATCH] Add coverage and slither analysis --- .gitignore | 6 +++++ .gitlab-ci.yml | 58 +++++++++++++++++++++++++++++++++++++++++++++ python/.coverage | Bin 0 -> 53248 bytes python/.coveragerc | 6 +++++ 4 files changed, 70 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 python/.coverage create mode 100644 python/.coveragerc diff --git a/.gitignore b/.gitignore index 8d35cb3..b24426c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ __pycache__ *.pyc +dist/ +build/ +gmon.out +*.egg-info +venv +.idea diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e8acf20 --- /dev/null +++ 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 AccountsIndex.sol + - slither AccountsIndex.sol --print human-summary diff --git a/python/.coverage b/python/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..9971562ac1ed15d54caa7cbf70779f00b6e4f276 GIT binary patch literal 53248 zcmeI)OKclO7zglO@79j<+M+13LX>6>ASY@Z$0?;sK|r866e?9M6@95}*Y-Hs*4}k@ z$7v#jkXximT#=BFDnSp3JM_+lBXDR>Jfw$VHE>kSQ7b%IlXV)xmm0jekQ$c`eZ-TFga0Mm8?L|k1 zU=vaFN#^ki_qbEyewd31yFA%DdG&+dRAy*My~cwwSzd|$`Z`KOD_TW4T%m+Yu2+`1 zFM5_!TH^i`v(`&kaw(rHA}p=v*7Cw-Roe-Q>G-y=U5D`%UTO$l-n4*I5-pwxue~&s z)_GZ=^I^|@u>CUw~=Z%1{;rKEctk3o~N0O<` z=%{)n9W}+%4lW z3uZySC$An)1X;e83iN9<=*ySZk!882mF2hiYHr!8(r8k*Y>&Dujltm&fXRSmivn9k zw;_V|D;I<2DUUs^{Duj%mScMgH5mk_?oB)L55@~DyJY!t@bR;(=(<&IIpHCJ0v`5h zSGLcBU2i-Xz1m8{UzKSrE@y+R#K#mlx}TuF7I!O}snsl}937_Q(Kk$$hJ4v4<$l7k zgCepl^+lh0<^yTQiAG!HKozGyT_*~eYRxK#yYD%8}>&8*V_{dl_&e04e2tWV=5P$##AOHafKmY;| zfB*y@CD5;HV@CWy#muvsHoQ+hP%t|)JDZ!C%@y{uLgC=-+`;`X7zu4O6Wxw~aeCi$ zL8$sz^IZHO#o26r$*uAHvQ5tsIwEhEt^A^A`M&46!q0QDl(R}Dx8Vps7d$_fU*^to zzG@fq^;NOtI+Wr}o}L2axw=)lNY6C+as&58-ZX2L?U*J#Es;GZAM)3YTZ(bZ_}lp1 zxbvt2VmkyN009U<00Izz00bZa0SG_<0{;hrer-&RuR!QM+OR4wKxlp1s2W{uNc3rA z>G(QBaQ}bsbH(_|I5~KaW-vhj0uX=z1Rwwb2tWV=5P$##wn5;ut}D$0|MgyYcne(K zB{$={w#glD@CKmXUy>dm<=OuGI2U)$nrx1Ikdj_A#?^b?9~IRD4*|DlsX00Izz00bZa z0SG_<0uX=z1a`E5rfSN7y#KEn_Z9lX1OW&@00Izz00bZa0SG_<0uX?}4iwO|fpqx$ z|2GxmSK~+HTjS;qEGCKs0SG_<0uX=z1Rwwb2tWV=5O^vD26bIc@6n%|zn#24^4Z#_ zLmDklXxDr8+*CK6++o=(5=^7xh9_qV_K`49ij5C8n~-d}1| za6SC}|GSEDkADCEPvh=W34%;R00Izz00bZa0SG_<0uX=z1Ry{HNxBxG>U!{@X~9P# zq0@zd;Qqg|8%Pj<00bZa0SG_<0uX=z1Rwwb2<&75dH)~h|2w&cQ8oxb00Izz00bZa q0SG_<0uX?JqR9XM$N4{60t6rc0SG_<0uX=z1Rwwb2tZ(G3;YY*rH1za literal 0 HcmV?d00001 diff --git a/python/.coveragerc b/python/.coveragerc new file mode 100644 index 0000000..d679f9d --- /dev/null +++ b/python/.coveragerc @@ -0,0 +1,6 @@ +[run] +branch = True +[report] +omit = .venv/* + **/runnable/*.py +[html]