.gitlab-ci.yml 2.35 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

63 64 65 66 67 68 69 70 71 72 73 74 75
test_frontend:
  stage: test
  image: node:10.15.1-alpine
  cache:
    paths:
      - frontend/node_modules/
  before_script:
    - cd frontend && npm i
  script:
    - npm run test
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
76
flake8:
Florent Chehab's avatar
Florent Chehab committed
77 78
  stage: lint
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
Florent Chehab's avatar
Florent Chehab committed
79
  script:
80
    - cd backend && flake8
Florent Chehab's avatar
Florent Chehab committed
81 82 83
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
84
eslint:
Florent Chehab's avatar
Florent Chehab committed
85 86 87 88 89 90 91
  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
92
  script:
Florent Chehab's avatar
Florent Chehab committed
93
    - npm run lint
Florent Chehab's avatar
Florent Chehab committed
94 95 96
  tags:
    - docker

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
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
112
pages:
113
  stage: documentation
114
  image: floawfloaw/plantuml
Florent Chehab's avatar
Florent Chehab committed
115
  dependencies:
Florent Chehab's avatar
Florent Chehab committed
116
    - test_back
117
    - generate_UML_svg
Florent Chehab's avatar
Florent Chehab committed
118
  script:
119
    - mkdir .public
120
    - mv backend/htmlcov/ .public/coverage
121
    - mv documentation/ .public/documentation
122
    - mv .public public
Florent Chehab's avatar
Florent Chehab committed
123 124 125 126
  artifacts:
    paths:
      - public
    expire_in: 1 month
Florent Chehab's avatar
Florent Chehab committed
127
  only:
Florent Chehab's avatar
Florent Chehab committed
128
    - master
Florent Chehab's avatar
Florent Chehab committed
129 130
  tags:
    - docker