.gitlab-ci.yml 3.1 KB
Newer Older
1
2
# In CI we use the latest docker images.

3
stages:
Florent Chehab's avatar
Florent Chehab committed
4
  - check
5
  - test
Florent Chehab's avatar
Florent Chehab committed
6
  - lint
Florent Chehab's avatar
Florent Chehab committed
7
  - svg-gen-docu # required to be done before documentation and in separate stages
8
  - documentation
9

10
11
12
13
.only-default: &only-default
  only:
    - master
    - merge_requests
Florent Chehab's avatar
Florent Chehab committed
14
15

check_back:
16
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
17
  stage: check
18
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
Florent Chehab's avatar
Florent Chehab committed
19
  before_script:
20
    - sh ./backend/init_logs.sh
Florent Chehab's avatar
Florent Chehab committed
21
    - make setup
Florent Chehab's avatar
Florent Chehab committed
22
  script:
Florent Chehab's avatar
Florent Chehab committed
23
    - cd backend && ./manage.py check
24
    - cd ../documentation && make extract_django # Try to generate .dot files for the system architecture
Florent Chehab's avatar
Florent Chehab committed
25
26
27
28
  artifacts:
    paths:
      - documentation/generated/
    expire_in: 1 hour
29
30
31
  variables:
    FIXER_API_TOKEN: 91ed43e97a55f9ed9a501cc005c15e9c
    UTC_API_ENDPOINT: http://192.168.122.1:8083/api
Florent Chehab's avatar
Florent Chehab committed
32
33
34
35
  tags:
    - docker

check_front:
36
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
37
  stage: check
Florent Chehab's avatar
Florent Chehab committed
38
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v1.2.0
Florent Chehab's avatar
Florent Chehab committed
39
  before_script:
40
    - cd frontend && cp -R /usr/src/deps/node_modules .
Florent Chehab's avatar
Florent Chehab committed
41
  script:
42
    - yarn build
43
44
45
46
  artifacts:
    paths:
      - frontend/webpack-stats.json
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
47
48
49
50
  tags:
    - docker

test_back:
51
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
52
  stage: test
53
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
Florent Chehab's avatar
Florent Chehab committed
54
55
56
57
58
  variables:
    POSTGRES_DB: postgres
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres
    POSTGRES_HOST: postgres
59
    POSTGRES_PORT: 5432 # We absolutely need this one since a gitlab runner will inject a similar variable; will cause tests to fail.
60
61
    FIXER_API_TOKEN: 91ed43e97a55f9ed9a501cc005c15e9c
    UTC_API_ENDPOINT: http://192.168.122.1:8083/api
Florent Chehab's avatar
Florent Chehab committed
62
  services:
Florent Chehab's avatar
Florent Chehab committed
63
    - postgres:10.5
Florent Chehab's avatar
Florent Chehab committed
64
  before_script:
65
    - sh ./backend/init_logs.sh
Florent Chehab's avatar
Florent Chehab committed
66
    - make setup
Florent Chehab's avatar
Florent Chehab committed
67
  script:
Florent Chehab's avatar
Florent Chehab committed
68
    - cd backend
Florent Chehab's avatar
Florent Chehab committed
69
    - pytest base_app/ backend_app/ --cov --cov-config .coveragerc --cov-report term --cov-report html
Florent Chehab's avatar
Florent Chehab committed
70
71
  artifacts:
    paths:
72
      - backend/htmlcov/
Florent Chehab's avatar
Florent Chehab committed
73
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
74
75
76
  tags:
    - docker

77
test_frontend:
78
  <<: *only-default
79
  stage: test
Florent Chehab's avatar
Florent Chehab committed
80
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v1.2.0
81
  before_script:
82
    - cd frontend && cp -R /usr/src/deps/node_modules .
83
  script:
84
    - yarn test
85
86
87
  tags:
    - docker

Florent Chehab's avatar
linting  
Florent Chehab committed
88
flake8:
89
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
90
  stage: lint
91
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
Florent Chehab's avatar
linting  
Florent Chehab committed
92
  script:
93
    - cd backend && flake8
Florent Chehab's avatar
linting  
Florent Chehab committed
94
95
96
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
97
eslint:
98
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
99
  stage: lint
Florent Chehab's avatar
Florent Chehab committed
100
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v1.2.0
Florent Chehab's avatar
Florent Chehab committed
101
  before_script:
102
    - cd frontend && cp -R /usr/src/deps/node_modules .
Florent Chehab's avatar
Florent Chehab committed
103
  script:
104
    - yarn lint
Florent Chehab's avatar
Florent Chehab committed
105
106
107
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
108
generate_UML_svg:
109
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
110
111
112
113
114
115
116
117
118
119
120
121
  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
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
122
pages:
123
  stage: documentation
124
  image: floawfloaw/plantuml
Florent Chehab's avatar
Florent Chehab committed
125
  dependencies:
Florent Chehab's avatar
Florent Chehab committed
126
    - test_back
Florent Chehab's avatar
Florent Chehab committed
127
    - generate_UML_svg
Florent Chehab's avatar
Florent Chehab committed
128
  script:
129
    - mkdir .public
130
    - mv backend/htmlcov/ .public/coverage
131
    - mv documentation/ .public/documentation
132
    - mv .public public
Florent Chehab's avatar
Florent Chehab committed
133
134
135
136
  artifacts:
    paths:
      - public
    expire_in: 1 month
Florent Chehab's avatar
Florent Chehab committed
137
  only:
Florent Chehab's avatar
Florent Chehab committed
138
    - master
Florent Chehab's avatar
Florent Chehab committed
139
140
  tags:
    - docker