.gitlab-ci.yml 1.81 KB
Newer Older
1 2
stages:
  - static-test
3
  - build
4
  - integration-test
5
  - deploy
Daniele Venzano's avatar
Daniele Venzano committed
6
  - cleanup
7 8

variables:
Daniele Venzano's avatar
Daniele Venzano committed
9
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
10 11 12
  POSTGRES_DB: zoe
  POSTGRES_USER: zoeuser
  POSTGRES_PASSWORD: zoepass
13
  ZOE_TEST_IMAGE: zoe-test:$CI_PIPELINE_ID
14
  ZOE_COMMON_OPTIONS: --debug --deployment-name test${CI_BUILD_REF} --dbuser ${POSTGRES_USER} --dbhost postgres --dbport 5432 --dbname ${POSTGRES_DB} --dbpass ${POSTGRES_PASSWORD} --master-url tcp://localhost:4850 --listen-port 5100 --workspace-base-path /tmp --overlay-network-name bridge
Daniele Venzano's avatar
Daniele Venzano committed
15

Daniele Venzano's avatar
Daniele Venzano committed
16 17 18 19 20 21 22
cache:
  paths:
    - "$CI_PROJECT_DIR/pip-cache"
  key: "$CI_PROJECT_ID"

pylint:
  stage: static-test
23
  image: python:3.5
Daniele Venzano's avatar
Daniele Venzano committed
24 25 26 27
  script:
    - pip install -U pip setuptools
    - pip install -r requirements.txt
    - pip install -r requirements_tests.txt
28
    - pylint *.py zoe_*
Daniele Venzano's avatar
Daniele Venzano committed
29 30

unittests:
31
  stage: static-test
Daniele Venzano's avatar
Daniele Venzano committed
32
  services:
33 34
    - postgres:9.5
  image: python:3.5
35
  script:
Daniele Venzano's avatar
Daniele Venzano committed
36
    - pip install -U pip setuptools
37 38
    - pip install -r requirements.txt
    - pip install -r requirements_tests.txt
39
    - pytest --ignore integration_tests --tb=short --cov-report=term --cov zoe_api --cov zoe_lib --cov zoe_master
Daniele Venzano's avatar
Daniele Venzano committed
40

Daniele Venzano's avatar
Daniele Venzano committed
41
docs-test:
Daniele Venzano's avatar
Daniele Venzano committed
42
  stage: static-test
43
  image: python:3.5
Daniele Venzano's avatar
Daniele Venzano committed
44 45 46 47 48 49
  script:
    - pip install -U pip setuptools
    - pip install -r requirements.txt
    - pip install -r requirements_tests.txt
    - doc8 docs/
    - sh ./build_docs.sh
50 51 52 53 54

images:
  image: docker:latest
  stage: build
  before_script:
55 56
    - mkdir -p $HOME/.docker
    - echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
57
  script:
58 59
    - docker build --pull -t zoerepo/${ZOE_TEST_IMAGE} -f Dockerfile.test .
    - docker push zoerepo/${ZOE_TEST_IMAGE}
Daniele Venzano's avatar
Daniele Venzano committed
60
    - docker rm -f nginx0-1-integration_test || true
61 62 63 64

api-test:
  stage: integration-test
  services:
65
    - postgres:9.5
66
  image: zoerepo/${ZOE_TEST_IMAGE}
67
  script:
Daniele Venzano's avatar
Daniele Venzano committed
68
    - bash ./run_integration_tests.sh