Compare commits

...

36 Commits

Author SHA1 Message Date
c26fe7630b add rules to run on mr for test 2021-05-25 07:58:04 -07:00
897dc9bf00 test changes directive 2021-05-25 07:54:39 -07:00
bc4b97f218 fix mr rules 2021-05-25 07:49:32 -07:00
774b547b7b fix yaml issue 2021-05-25 07:43:45 -07:00
a82c5d1d10 clarity of build step names and remove unused code 2021-05-25 07:38:39 -07:00
d2ea3358c7 Update apps/cic-eth/.gitlab-ci.yml 2021-05-23 02:31:44 +00:00
8713952ed4 Update ci_templates/.cic-template.yml 2021-05-23 02:26:49 +00:00
575b2a196a Update .gitlab-ci.yml, apps/cic-eth/.gitlab-ci.yml, ci_templates/.cic-template.yml files 2021-05-23 02:11:18 +00:00
b656370c50 Update .gitlab-ci.yml 2021-05-23 01:57:56 +00:00
9c883e0796 Update ci_templates/.cic-template.yml, apps/cic-eth/.gitlab-ci.yml files 2021-05-23 01:55:40 +00:00
e9129f99b3 Update ci_templates/.cic-template.yml 2021-05-23 01:49:15 +00:00
68f823a2e5 Update ci_templates/.cic-template.yml 2021-05-23 01:39:38 +00:00
6c62976f32 added test files 2021-05-22 17:36:06 -07:00
e442f0399a Update apps/cic-eth/.gitlab-ci.yml, ci_templates/.cic-template.yml files 2021-05-23 00:04:05 +00:00
830297d352 Update apps/cic-eth/.gitlab-ci.yml 2021-05-21 17:35:56 +00:00
559f386657 Update ci_templates/.cic-template.yml 2021-05-21 17:21:50 +00:00
573ee3e2ec Update ci_templates/.cic-template.yml 2021-05-21 17:20:11 +00:00
36858f71e1 Update ci_templates/.cic-template.yml 2021-05-21 17:13:23 +00:00
053a679a5e Update ci_templates/.cic-template.yml 2021-05-21 17:10:54 +00:00
nolash
91b964eefc Merge remote-tracking branch 'origin/master' into cic-eth-unittest 2021-05-21 18:58:11 +02:00
aae0077d66 Update ci_templates/.cic-template.yml 2021-05-21 16:55:55 +00:00
nolash
c10783aebf Merge branch 'cic-eth-unittest' of gitlab.com:grassrootseconomics/cic-internal-integration into cic-eth-unittest 2021-05-21 18:55:04 +02:00
nolash
7d1837eafa
Fill in missing provisions 2021-05-21 18:54:25 +02:00
cd7c2baa90 Update ci_templates/.cic-template.yml 2021-05-21 16:48:05 +00:00
78d632e2c7 Update ci_templates/.cic-template.yml 2021-05-21 16:43:53 +00:00
8355347323 Update ci_templates/.cic-template.yml, apps/cic-eth/.gitlab-ci.yml files 2021-05-21 16:39:28 +00:00
dad40c993c Update ci_templates/.cic-template.yml 2021-05-21 16:31:47 +00:00
e4437ffcf3 Update ci_templates/.cic-template.yml 2021-05-21 16:21:03 +00:00
9a44107c24 Update ci_templates/.cic-template.yml 2021-05-21 16:16:57 +00:00
e708b7e407 Update ci_templates/.cic-template.yml, apps/cic-eth/.gitlab-ci.yml files 2021-05-21 16:08:09 +00:00
0e0276b550 Update apps/cic-eth/.gitlab-ci.yml 2021-05-21 15:06:38 +00:00
053d012f7b update docker file and setup 2021-05-20 21:32:33 -07:00
221be7f803 update test dep and docker installs 2021-05-20 08:51:57 -07:00
c2dd30628d Update apps/cic-eth/.gitlab-ci.yml 2021-05-20 15:50:19 +00:00
158036f38f Update apps/cic-eth/.gitlab-ci.yml 2021-05-20 15:05:47 +00:00
9ff26e6eb0 Update apps/cic-eth/.gitlab-ci.yml 2021-05-20 14:59:19 +00:00
5 changed files with 80 additions and 51 deletions

View File

@ -5,14 +5,27 @@
.cic_eth_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- $CONTEXT/$APP_NAME/**/*
when: always
build-mr-cic-eth:
extends:
- .cic_eth_changes_target
- .py_build_merge_request
- .cic_eth_variables
- .cic_eth_changes_target
- .py_build_target_test
test-mr-cic-eth:
extends:
- .cic_eth_variables
- .cic_eth_changes_target
- .cic_eth_changes_target
stage: test
image: $CI_REGISTRY_IMAGE/$APP_NAME-test:latest
script:
- cd apps/$APP_NAME/
- pytest tests/unit/
build-push-cic-eth:
extends:

View File

@ -1,48 +1,63 @@
# FROM grassrootseconomics:cic
#FROM python:3.8.6-alpine
FROM python:3.8.6-slim-buster
#COPY --from=0 /usr/local/share/cic/solidity/ /usr/local/share/cic/solidity/
FROM python:3.8.6-slim-buster as compile
WORKDIR /usr/src/cic-eth
ARG pip_extra_index_url_flag='--index https://pypi.org/simple --extra-index-url https://pip.grassrootseconomics.net:8433'
ARG root_requirement_file='requirements.txt'
#RUN apk update && \
# apk add gcc musl-dev gnupg libpq
#RUN apk add postgresql-dev
#RUN apk add linux-headers
#RUN apk add libffi-dev
RUN apt-get update && \
apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git
# Copy shared requirements from top of mono-repo
RUN echo "copying root req file: ${root_requirement_file}"
#COPY $root_requirement_file .
#RUN pip install -r $root_requirement_file $pip_extra_index_url_flag
RUN /usr/local/bin/python -m pip install --upgrade pip
#RUN git clone https://gitlab.com/grassrootseconomics/cic-base.git && \
# cd cic-base && \
# git checkout 7ae1f02efc206b13a65873567b0f6d1c3b7f9bc0 && \
# python merge_requirements.py | tee merged_requirements.txt
#RUN cd cic-base && \
# pip install $pip_extra_index_url_flag -r ./merged_requirements.txt
RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2b9
#RUN python -m venv venv && . venv/bin/activate
COPY cic-eth/scripts/ scripts/
COPY cic-eth/setup.cfg cic-eth/setup.py ./
COPY cic-eth/cic_eth/ cic_eth/
# Copy app specific requirements
COPY cic-eth/requirements.txt .
COPY cic-eth/test_requirements.txt .
ARG pip_extra_index_url_flag='--index https://pypi.org/simple --extra-index-url https://pip.grassrootseconomics.net:8433'
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install semver
# TODO use a packaging style that lets us copy requirments only ie. pip-tools
COPY cic-eth/ .
RUN pip install $pip_extra_index_url_flag .
RUN pip install $pip_extra_index_url_flag pycryptodome==3.10.1
# --- TEST IMAGE ---
FROM python:3.8.6-slim-buster as test
RUN apt-get update && \
apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git
WORKDIR /usr/src/cic-eth
RUN /usr/local/bin/python -m pip install --upgrade pip
COPY --from=compile /usr/local/bin/ /usr/local/bin/
COPY --from=compile /usr/local/lib/python3.8/site-packages/ \
/usr/local/lib/python3.8/site-packages/
# TODO we could use venv inside container to isolate the system and app deps further
# COPY --from=compile /usr/src/cic-eth/ .
# RUN . venv/bin/activate
COPY cic-eth/test_requirements.txt .
RUN pip install $pip_extra_index_url_flag -r test_requirements.txt
COPY cic-eth .
ENV PYTHONPATH .
ENTRYPOINT ["pytest"]
# --- RUNTIME ---
FROM python:3.8.6-slim-buster as runtime
RUN apt-get update && \
apt install -y gnupg libpq-dev procps
WORKDIR /usr/src/cic-eth
COPY --from=compile /usr/local/bin/ /usr/local/bin/
COPY --from=compile /usr/local/lib/python3.8/site-packages/ \
/usr/local/lib/python3.8/site-packages/
COPY cic-eth/docker/* ./
RUN chmod 755 *.sh
COPY cic-eth/tests/ tests/
COPY cic-eth/scripts/ scripts/
# # ini files in config directory defines the configurable parameters for the application
# # they can all be overridden by environment variables
# # to generate a list of environment variables from configuration, use: confini-dump -z <dir> (executable provided by confini package)
@ -51,3 +66,4 @@ COPY cic-eth/cic_eth/db/migrations/ /usr/local/share/cic-eth/alembic/
COPY cic-eth/crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/
COPY util/liveness/health.sh /usr/local/bin/health.sh

View File

@ -11,17 +11,6 @@ while True:
requirements.append(l.rstrip())
f.close()
test_requirements = []
f = open('test_requirements.txt', 'r')
while True:
l = f.readline()
if l == '':
break
test_requirements.append(l.rstrip())
f.close()
setup(
install_requires=requirements,
tests_require=test_requirements,
install_requires=requirements
)

View File

@ -4,4 +4,3 @@ pytest-mock==3.3.1
pytest-cov==2.10.1
eth-tester==0.5.0b3
py-evm==0.3.0a20
giftable-erc20-token==0.0.8a9

View File

@ -9,7 +9,7 @@ variables:
.py_build_merge_request:
stage: build
variables:
- CI_DEBUG_TRACE: "true"
CI_DEBUG_TRACE: "true"
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
@ -18,6 +18,18 @@ variables:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
.py_build_target_test:
stage: build
variables:
CI_DEBUG_TRACE: "true"
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --target test --tarPath $APP_NAME-test-image.tar --destination $CI_REGISTRY_IMAGE/$APP_NAME-test:latest
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
.py_build_push:
stage: build
variables: