From d68995329c41597a8dc9e01964a45fc5d2a4c711 Mon Sep 17 00:00:00 2001 From: Idaapayo Date: Sun, 20 Feb 2022 19:47:03 +0000 Subject: [PATCH] Add coverage and slither analysis --- .gitignore | 2 ++ .gitlab-ci.yml | 58 +++++++++++++++++++++++++++++++++++++++++++++ python/.coverage | Bin 0 -> 53248 bytes python/.coveragerc | 7 ++++++ 4 files changed, 67 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 python/.coverage create mode 100644 python/.coveragerc diff --git a/.gitignore b/.gitignore index 3c088b0..59789c9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ dist/ __pycache__ *.pyc gmon.out +.idea +venv diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..842a265 --- /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 AddressDeclarator.sol + - slither AddressDeclarator.sol --print human-summary diff --git a/python/.coverage b/python/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..b08f937e43d4f72b651670b32a5a2f9de7388f6e GIT binary patch literal 53248 zcmeI)PmCMY9S86k&+ItfUGJodRwittJR%im#d^Je_#;ATSRg92NC6r_QJM_T_Vez5 zJ+qk^?`BJ@)&waajz}CT5EoL8Er=_JUU~(=r9wcY9{6*hIW%exiIo0+^Ji@*Sputt zkmx(Rw&%}#Z{GX7KjZO?{hP-gaU&&~e$bYYnAf&zx~|eyCtOC(= zTS~ZI!>!B6^%h06q_WVRP&N37N9*XA#{s9~_&n#h4T=@1MM`2haN9Ci6VIx(sW?Eo zw@4k2k`u{Hx*s$+_q9NJ^(7Tf3AtXvx=;B$9wns>{B||+Ma%W#VtSz)xxOdVaaHd` zs&T~vPBB_G5ng|3D6OZtKu;$z(|z^n^des&W*R(=+@#ETe#Y91$h)SC zblS^YITRz=apZ3lbECMCpBDC8*Uc5`vRB@L>deTwMw3__&pp;r>yqc=)s zeI(sN#i``2(!#_>#Yw|Cv+2yXZr;q7#>e$;(j$0W;>XZHA$U!%3tVy_`1aXfmeG>9 zJny`kGF~3CO81O!lyT02Gt1A`iN|wsmQUtm{WcBy{4fTx%xijC{ zvZ(ofOGz&|Bv8PIL)w)aig?$TAB^_*(g@c$jm4F6oR#dD!lU~k>T6lIqM3GEdX4lj z#Yf*HRT}cSPx5|}v4bLtGWErfdgdi*W{IX-d7#SDpI#;kPPHu?NiXNR=u2^RNnMs) zau9k@Mk;dKN^p=kGjV%bm7%ByiZ;?Abh2!GQ|)slIkWuCXUW_6jZAm9o-f^Yo8IlD zeJ~kboRE&?ZJA{|UCa%%jY~H6n#n;LXX#B&fAe6wJ`P??_P}FWQiHWbAq$nh#TlOD z6MWr1uhBmy2tWV=5P$##AOHafKmY;|fB*z;JOM+`>3Kf?H|<9?`(^w0_EDO_1OW&@ z00Izz00bZa0SG_<0uX?}RRu;(W0#%XQ89C~VT{l79R+hUb90rMxytPAVs2*N?RW3H zW8Tgg6Q%Te{GHSD)3c#&?&==S?xZ+et}gj)Rb6rEMnW&Dx(!)f3}hGvz8{5E6)ja{ zqYhfB&W97eaimj*q383j@?2Fm>>WF2tWV=5P$##AOHaf zK;YU7c$TSk<#)U`oLmy-i^fiR(b#FIdP@c}@`EbZR0uX=z z1Rwwb2tWV=5P$##AOL|IP{1&Xh4}mb_Fpvn-}cA$KkUERZ_xrK2tWV=5P$##AOHaf zKmY;|fB*!3Ab}Cf)C)IRuO0m8^w*v>Lx$P#s?lJ#d-t*?IA6OT5Uerqlt(h@i zd-3mQFJ7R(|6Y9m;{Gqbcw^qmagI|8M_Gv(MA-|9@?NZl9(FOb~zo1Rwwb2tWV=5P$##AOHafTo(fT;el>h z@ypOq{9>B%i($ksxtvL#3&hv|we8nMk&sCUKmY;|fB*y_009U<00Izz00cHEz}NqA z{=Z2)M1ueXAOHafKmY;|fB*y_009VGCj$Kaf1LkcCzXY4LI45~fB*y_009U<00Izz J00cHE@PG16QxO0F literal 0 HcmV?d00001 diff --git a/python/.coveragerc b/python/.coveragerc new file mode 100644 index 0000000..1951f90 --- /dev/null +++ b/python/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +[report] +omit = .venv/* + **/runnable/*.py +[html] +