From be3063a02fba3380577b110083f6ba4825a6a623 Mon Sep 17 00:00:00 2001 From: Henrik tom Woerden <henrik.tom-woerden@ds.mpg.de> Date: Fri, 19 Jul 2019 14:00:57 +0200 Subject: [PATCH] Revert "ci" This reverts commit 6603c6bd55bd9eaf57b0908cde913c2d5c5675e1. --- .gitlab-ci.yml | 130 ++++++++++++++++-------------------- tox.ini | 2 +- unittests/docker/Dockerfile | 7 ++ 3 files changed, 64 insertions(+), 75 deletions(-) create mode 100644 unittests/docker/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1c52cba..eb75a46d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,90 +20,72 @@ # # ** end header # + +variables: + CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-pylib-testenv + # When using dind service we need to instruct docker, to talk with the + # daemon started inside of the service. The daemon is available with + # a network connection instead of the default /var/run/docker.sock socket. + # + # The 'docker' hostname is the alias of the service container as described at + # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services + # + # Note that if you're using the Kubernetes executor, the variable should be set to + # tcp://localhost:2375/ because of how the Kubernetes executor connects services + # to the job container + # DOCKER_HOST: tcp://localhost:2375/ + # + # For non-Kubernetes executors, we use tcp://docker:2375/ + DOCKER_HOST: tcp://docker:2375/ + # When using dind, it's wise to use the overlayfs driver for + # improved performance. + DOCKER_DRIVER: overlay2 +services: + - docker:dind + +image: $CI_REGISTRY_IMAGE:latest + stages: - - setup - code_style - - build + - setup - test + - deploy -######### -# Setup -######### - -# install formatters -setup:install_formatters:python2.7: - tags: [ py27 ] - stage: setup - script: - - pip2 install --upgrade pycodestyle --user - -setup:install_formatters:python3.4: - tags: [ py34 ] - stage: setup - script: - - pip3.4 install --upgrade pycodestyle --user - -############ -# code_style -############ - -code_style:pycodestyle:python2.7: - tags: [ py27 ] - stage: code_style - script: - - ~/.local/bin/pycodestyle --count ./ - -code_style:pycodestyle:python3.4: - tags: [ py34 ] +code_style: stage: code_style script: - - ~/.local/bin/pycodestyle --count ./ - -######### -# Build -######### - -# install python client (python 2.7) -build:pycaosdb:python2.7: - tags: [ py27 ] - stage: build - script: - - python2.7 setup.py install --user + - pycodestyle --count ./ + - pylint3 --unsafe-load-any-extension=y -d all -e E,F src/caosdb/common + allow_failure: true -# install python client (python 3.4) -build:pycaosdb:python3.4: - tags: [ py34 ] - stage: build - script: - - python3.4 setup.py install --user - -######## -# Test -######## -# unit tests for pycaosdb -test:pycaosdb:py34: - tags: [ py34 ] +# pylint tests for pycaosdb +test: stage: test script: - touch ~/.pycaosdb.ini - - tox -r -e py34 + - tox -r -test:pycaosdb:py27: - tags: [ py27 ] - stage: test - script: - - touch ~/.pycaosdb.ini - - tox -r -e py27 - -# pylint tests for pycaosdb (python 3.4) -.test:pycaosdb:python3.4:pylint: - stage: test - script: - - /usr/bin/env python3.4 /home/caosdb/.local/bin/pylint --unsafe-load-any-extension=y -d all -e E,F client/PyCaosDB/caosdb/common/models.py +trigger_build: + stage: deploy + script: + - echo $TOKEN + - /usr/bin/curl -X POST + -F token=$TOKEN + -F "variables[PYLIB]=$CI_COMMIT_REF_NAME" + -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline -# pylint tests for pycaosdb (python 2.7) -.test:pycaosdb:python2.7:pylint: - stage: test - script: - - /usr/bin/env python2.7 /home/caosdb/.local/bin/pylint --unsafe-load-any-extension=y -d all -e E,F client/PyCaosDB/caosdb/common/models.py +build-testenv: + image: docker:latest + stage: setup + script: + - cd unittests/docker + - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + # use here general latest or specific branch latest... + - docker pull $CI_REGISTRY_IMAGE:latest || true + - docker build + --pull + --build-arg COMMIT=$CI_COMMIT_SHORT_SHA + --cache-from $CI_REGISTRY_IMAGE:latest + -t $CI_REGISTRY_IMAGE:latest . + - docker push $CI_REGISTRY_IMAGE:latest diff --git a/tox.ini b/tox.ini index 74d8c643..dcd29575 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist= py27, py34, py35, py36 +envlist= py27, py34, py35, py36, py37 skip_missing_interpreters = true [testenv] deps=nose diff --git a/unittests/docker/Dockerfile b/unittests/docker/Dockerfile new file mode 100644 index 00000000..295d5e0e --- /dev/null +++ b/unittests/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM debian:latest +RUN apt-get update && \ + apt-get install pylint3 python3-pip tox git \ + curl pycodestyle -y +ARG COMMIT="dev" +RUN git clone -b dev https://gitlab.gwdg.de/bmp-caosdb/caosdb-pylib.git && \ + cd caosdb-pylib && git checkout $COMMIT && pip3 install . -- GitLab