Commit 1581cedf authored by Rémi Cailletaud's avatar Rémi Cailletaud

test docker ci

parent 197e360e
image : python:3
stages :
- test
- doc
- pypi
- build
- deploy
before_script:
- cd python-dice
- python setup.py install
job_test:
stage : test
script:
- python setup.py test
- pip install coverage
- coverage run -m unittest discover
- coverage report
job_codestyle:
stage: test
script:
- pip install pycodestyle
- pycodestyle dice.py
allow_failure: true
pages:
stage : deploy
only:
variables:
- $CI_COMMIT_MESSAGE =~ /^\[doc\].*/i
script:
- pip install sphinx
- python setup.py build_sphinx
- mv build/sphinx/html ../public
artifacts:
paths:
- public
pypi:
stage : deploy
only:
- /^version-.*$/
script:
- version=$(echo $CI_COMMIT_REF_NAME|cut -d "-" -f 2)
- sed -i -e "s/version='.*',/version='$version',/g" setup.py
- pip install twine
- pip wheel . -w wheelhouse
- twine upload --repository-url https://test.pypi.org/legacy/ wheelhouse/*
build:
stage : build
except:
- /^version-.*$/
image: docker
services:
- docker:dind
before_script:
- docker info
- cd python-dice
script:
- docker build -t $DOCKER_LOGIN/dice-server .
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_LOGIN --password-stdin
- docker push $DOCKER_LOGIN/dice-server
deploy:
stage: deploy
except:
- /^version-.*$/
when: manual
image: docker
variables:
DOCKER_HOST: "osug-docker-ci.u-ga.fr:2376"
before_script:
- docker info
- cd python-dice
script:
- docker pull ciformation/dice-server:latest
- if [ "$(docker ps -q -f name=dice)" ]; then docker stop dice; fi;
- docker run --name dice -d --rm -p 8090:8081 ciformation/dice-server:latest
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