commit c236a9ea7859cc7acb3107c584c2c7e15dcb38f3
parent 84ce22e8b63da62acfe2979fb277fca3dbbaf081
Author: Blair Vanderlugt <blair.vanderlugt@gmail.com>
Date: Wed, 24 Nov 2021 21:03:14 +0000
Merge branch 'add-tests' into 'master'
feat: add slither and unit test run
See merge request cicnet/eth-erc20!4
Diffstat:
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
@@ -4,3 +4,4 @@ dist/
build/
gmon.out
*.egg-info
+.venv/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
@@ -0,0 +1,26 @@
+stages:
+ - test
+ - slither-analyzer
+
+test:
+ image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-py-alpine:latest
+ cache:
+ - key:
+ files:
+ - requirements.txt
+ - test_requirements.txt
+ paths:
+ - /root/.cache/pip
+ script:
+ - cd python
+ - pip install --extra-index-url https://pip.grassrootseconomics.net:8433 -r test_requirements.txt
+ - pip install --extra-index-url https://pip.grassrootseconomics.net:8433 -r test_requirements.txt
+ - bash run_tests.sh
+
+
+slither-analize:
+ image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-solc-py-alpine:latest
+ script:
+ - pip install slither-analyzer
+ - slither solidity/
+
diff --git a/Dockerfile b/Dockerfile
@@ -5,7 +5,8 @@ FROM python:3.8.6-alpine
COPY --from=0 /usr/bin/solc /usr/bin/solc
RUN apk update &&\
- apk add gcc bash musl-dev
+ apk add gcc bash musl-dev libffi-dev openssl-dev autoconf automake build-base \
+ libtool pkgconfig python3-dev cargo
WORKDIR /usr/src
@@ -14,6 +15,8 @@ WORKDIR /usr/src
COPY ./solidity/ /usr/src/giftable_erc20_token/solidity/
COPY ./python/ /usr/src/giftable_erc20_token/python/
+RUN chmod +x ./python/run_tests.sh
+
RUN cd giftable_erc20_token/solidity && \
solc GiftableToken.sol --abi | awk 'NR>3' > GiftableToken.abi.json
@@ -24,5 +27,7 @@ RUN cd giftable_erc20_token/solidity && \
RUN cd giftable_erc20_token/python && \
pip install --extra-index-url https://pip.grassrootseconomics.net:8433 .
+RUN pip install slither-analyzer
+
# To deploy:
# giftable-token-deploy --contracts-dir giftable_erc20_token/solidity/ <amount>