.gitlab-ci.yml 2.15 KB
Newer Older
1
stages:
Florent Chehab's avatar
Florent Chehab committed
2
  - check
3
  - test
Florent Chehab's avatar
Florent Chehab committed
4
  - lint
5
  - svg-gen-docu # required to be done before documentation and in separate stages
6
  - documentation
7

Florent Chehab's avatar
Florent Chehab committed
8
variables:
Florent Chehab's avatar
Florent Chehab committed
9 10
  ENV: DEV
  SECRET_KEY: stupid_key_for_CI
11 12
  DJANGO_ADMIN_USERNAME: admin
  DJANGO_ADMIN_PASSWORD: admin
Florent Chehab's avatar
Florent Chehab committed
13 14 15 16 17
  POSTGRES_DB: postgres
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: postgres
  DB_HOST: postgres
  DB_PORT: 5432
Florent Chehab's avatar
Florent Chehab committed
18

Florent Chehab's avatar
Florent Chehab committed
19 20 21 22 23 24 25

check_back:
  stage: check
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
  services:
    - postgres:10.5
  script:
26 27 28 29 30 31
    - cd backend && ./manage.py check
    - cd ../documentation && make extract_django  # Try to generate .dot files for the system architecture
  artifacts:
    paths:
      - documentation/generated/
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
  tags:
    - docker

check_front:
  stage: check
  image: node:10.15.1-alpine
  cache:
    paths:
      - frontend/node_modules/
  before_script:
    - cd frontend && npm i
  script:
    - npm run build
  tags:
    - docker

test_back:
Florent Chehab's avatar
Florent Chehab committed
49
  stage: test
Florent Chehab's avatar
Florent Chehab committed
50
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
Florent Chehab's avatar
Florent Chehab committed
51
  services:
Florent Chehab's avatar
Florent Chehab committed
52
    - postgres:10.5
Florent Chehab's avatar
Florent Chehab committed
53
  script:
Florent Chehab's avatar
Florent Chehab committed
54
    - cd backend
Florent Chehab's avatar
Florent Chehab committed
55
    - pytest base_app/ backend_app/ --cov-report html
Florent Chehab's avatar
Florent Chehab committed
56 57
  artifacts:
    paths:
58
      - backend/htmlcov/
59
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
60 61 62
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
63
flake8:
Florent Chehab's avatar
Florent Chehab committed
64 65
  stage: lint
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
Florent Chehab's avatar
Florent Chehab committed
66
  script:
67
    - cd backend && flake8
Florent Chehab's avatar
Florent Chehab committed
68 69 70
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
71
eslint:
Florent Chehab's avatar
Florent Chehab committed
72 73 74 75 76 77 78
  stage: lint
  image: node:10.15.1-alpine
  cache:
    paths:
      - frontend/node_modules/
  before_script:
    - cd frontend && npm i
Florent Chehab's avatar
Florent Chehab committed
79
  script:
Florent Chehab's avatar
Florent Chehab committed
80
    - npm run lint
Florent Chehab's avatar
Florent Chehab committed
81 82 83
  tags:
    - docker

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
generate_UML_svg:
  stage: svg-gen-docu
  image: floawfloaw/plantuml
  script: cd documentation && make convert_to_svg
  dependencies:
    - check_back
  artifacts:
    paths:
      - documentation/generated/
    expire_in: 1 hour
  only:
    - master
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
99
pages:
100
  stage: documentation
101
  image: floawfloaw/plantuml
Florent Chehab's avatar
Florent Chehab committed
102
  dependencies:
Florent Chehab's avatar
Florent Chehab committed
103
    - test_back
104
    - generate_UML_svg
Florent Chehab's avatar
Florent Chehab committed
105
  script:
106
    - mkdir .public
107
    - mv backend/htmlcov/ .public/coverage
108
    - mv documentation/ .public/documentation
109
    - mv .public public
Florent Chehab's avatar
Florent Chehab committed
110 111 112 113
  artifacts:
    paths:
      - public
    expire_in: 1 month
Florent Chehab's avatar
Florent Chehab committed
114
  only:
Florent Chehab's avatar
Florent Chehab committed
115
    - master
Florent Chehab's avatar
Florent Chehab committed
116 117
  tags:
    - docker