Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
ARG eos_branch=v1.3.1
ARG eos_symbol=SYS

FROM tokenika/eosio:v1.5.0

############## PYTHON #############################################################################################
## Based mostly on https://github.com/docker-library/python/blob/005dda958/3.5/jessie/Dockerfile
ARG python_version=3.5.6

ENV PATH /usr/local/bin:$PATH

# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
ENV TERM xterm

RUN set -ex \
\
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${python_version%%[a-z]*}/Python-$python_version.tar.xz" \
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${python_version%%[a-z]*}/Python-$python_version.tar.xz.asc" \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--enable-loadable-sqlite-extensions \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--without-ensurepip \
&& make -j "$(nproc)" \
&& make install \
&& ldconfig \
\
&& find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' + \
&& rm -rf /usr/src/python \
\
&& python3 --version

# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python3-config python-config

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 18.0

RUN set -ex; \
\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py

RUN python -m pip install termcolor
############## EOS CDT #############################################################################################

RUN wget https://github.com/eosio/eosio.cdt/releases/download/v1.4.1/eosio.cdt-1.4.1.x86_64.deb && \
apt install ./eosio.cdt-1.4.1.x86_64.deb \
&& rm ./eosio.cdt-1.4.1.x86_64.deb

############## EOS FACTORY #############################################################################################

ARG eosfactory_branch=master
RUN git clone -b "$eosfactory_branch" https://github.com/tokenika/eosfactory.git /opt/eosfactory/
WORKDIR /opt/eosfactory/
RUN git branch
RUN git log -10 --oneline
RUN mkdir /opt/workspace
RUN apt-get update && apt-get install -y expect
RUN mkdir ~/eosio-wallet/
RUN /opt/eosfactory/tests/integration/expect_script.sh

# https://superuser.com/a/1253889/59009
RUN sed -i 's/mesg n || true/tty -s \&\& mesg n || true/g' /root/.profile
RUN chmod +x ./tests/unittest.sh

WORKDIR /opt/eosfactory/tests/

# bash loads .profile by default
ENTRYPOINT ["/bin/bash", "-l", "-c"]
54 changes: 22 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,42 @@
version: 2
jobs:
build:
working_directory: ~/ore-protocol
docker:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
- image: circleci/python:3.6.1

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo
- image: bcelebci/ore-protocol
environment:
PIPENV_VENV_IN_PROJECT: true

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt

- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}

# - restore_cache: # restores saved dependency cache if the Branch key template or requirements.txt files have not changed since the previous run
# key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
# - run:
# name: install dependencies
# command: |
# ./expect_script.sh
# sudo -H python3 -m pip install -e eosfactory/
# python3 eosfactory/eosfactory/install.py /opt/eos ~/testeos/contracts
# run tests!
# this example uses Django's built-in test-runner
# other common Python testing frameworks include pytest and nose
# https://pytest.org
# https://nose.readthedocs.io
# - save_cache: # special step to save dependency cache
# key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
# paths:
# - "venv"
- run:
name: run tests
command: |
. venv/bin/activate
python manage.py test
tests/build_and_test.sh
python3 tests/standard_token.py
python3 tests/rights_registry.py
python3 tests/instrument.py
python3 tests/usage_log.py

- store_artifacts:
path: test-reports
destination: test-reports

destination: test-reports
19 changes: 19 additions & 0 deletions tests/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

cd ~/ore-protocol/contracts

cd ore.instrument && mkdir build
eosio-cpp ore.instrument.cpp -o build/ore.instrument.wast
eosio-abigen ore.instrument.cpp --contract=ore.instrument --output=build/ore.instrument.abi

cd ../ore.rights_registry && mkdir build
eosio-cpp ore.rights_registry.cpp -o build/ore.rights_registry.wast
eosio-abigen ore.rights_registry.cpp --contract=ore.rights_registry --output=build/ore.rights_registry.abi

cd ../ore.usage_log && mkdir build
eosio-cpp ore.usage_log.cpp -o build/ore.usage_log.wast
eosio-abigen ore.usage_log.cpp --contract=ore.usage_log --output=build/ore.usage_log.abi

cd ../ore.standard_token && mkdir build
eosio-cpp ore.standard_token.cpp -o build/ore.standard_token.wast
eosio-abigen ore.standard_token.cpp --contract=ore.standard_token --output=build/ore.standard_token.abi
Loading