Commit 91d40d28 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

New CI pipeline including docker builds & release

parent e04f5c18
......@@ -2,6 +2,7 @@
current_version = 0.3.2
commit = True
tag = True
tag_name = {new_version}
[bumpversion:file:setup.py]
.idea
fractalis.log*
*.DS_Store
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
*.egg
.eggs/
.cache/
dist/
.coverage
dump.rdb
tests
\ No newline at end of file
**
!dist/
!requirements.txt
!tests/
\ No newline at end of file
image: centos:latest
image: centos:7
services:
redis:
image: 'redis:3.2-alpine'
rabbitmq:
image: 'rabbitmq:3.7-alpine'
variables:
PYPI_USER: SECURE
PYPI_PASSWORD: SECURE
PYPI_PASS: SECURE
DOCKER_USER: SECURE
DOCKER_PASS: SECURE
DOCKER_IMAGE_TAG: fractalis:$CI_COMMIT_TAG
SDIST: fractalis-$CI_COMMIT_TAG.tar.gz
stages:
- prepare
- build
- test
- release
test:all:
prepare:
stage: prepare
script:
- yum install -y epel-release
- yum update -y
- yum install -y \
python34 \
python34-pip \
yum-utils \
device-mapper-persistent-data \
lvm2
- yum-config-manager \
--add-repo https://download.docker.com/linux/centos/docker-ce.repo
- yum install -y docker-ce
- systemctl start docker
- pip3 install twine
artifacts:
untracked: true
build:
stage: build
script:
- python3 setup.py sdist
- docker build -t $DOCKER_IMAGE_TAG --build-arg SDIST=$SDIST .
- docker save $DOCKER_IMAGE_TAG -o image.tar
artifacts:
paths:
- dist/$SDIST
- image.tar
test:
stage: test
script:
- yum install -y epel-release
- yum update -y
- yum install -y rabbitmq-server redis python34 python34-pip python34-devel readline-devel R
- pip3 install . --trusted-host 10.79.2.238 -i https://10.79.2.238/simple
- pip3 install -r requirements.txt --trusted-host 10.79.2.238 -i https://10.79.2.238/simple
- R -e 'source("https://bioconductor.org/biocLite.R"); biocLite(); biocLite("limma")'
- redis-server --daemonize yes
- rabbitmq-server -detached
- celery worker -A fractalis:celery -D -l info
- pytest --cov=fractalis
- flake8
- docker load -i image.tar
- >
docker run fractalis:$CI_COMMIT_TAG
-e REDIS_HOST=redis -e RABBITMQ_HOST=rabbitmq
sh -c "celery worker -D -A fractalis:celery
&& pip3 install -r requirements.txt
&& flake8
&& pytest tests"
release:pypi:
stage: release
script:
- yum install -y epel-release
- yum update -y
- yum install -y python34 python34-pip
- pip3 install twine --trusted-host 10.79.2.238 -i https://10.79.2.238/simple
- python3 setup.py sdist
- twine upload dist/* -u ${PYPI_USER} -p ${PYPI_PASSWORD}
- twine upload dist/$SDIST -u $PYPI_USER -p $PYPI_PASS
only:
- tags
release:docker:
stage: release
script:
- docker load -i image.tar
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push $DOCKER_IMAGE_TAG
only:
- tags
\ No newline at end of file
FROM buildpack-deps:stretch
RUN mkdir /app
COPY . /app
WORKDIR /app
ARG SDIST
RUN mkdir /app/
COPY dist/$SDIST /app/
COPY requirements.txt /app/
COPY tests/ /app/tests/
WORKDIR /app/
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
r-base \
......@@ -12,6 +13,5 @@ RUN apt-get update \
python3-pip \
python3-setuptools \
r-bioc-limma
RUN pip3 install .
RUN pip3 install gunicorn
RUN pip3 install wheel
RUN pip3 install $SDIST gunicorn
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment