.gitlab-ci.yml 3.33 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
.only-default: &only-default
  only:
    - merge_requests
13
14
    - dev
    - master
Florent Chehab's avatar
Florent Chehab committed
15
16

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

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

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

78
test_frontend:
79
  <<: *only-default
80
  stage: test
81
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v2.0.0
82
  before_script:
83
    - cd frontend && mkdir -p node_modules && mv -f /usr/src/deps/node_modules/* /usr/src/deps/node_modules/.bin ./node_modules/
84
  script:
85
    - yarn test
86
87
88
  tags:
    - docker

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

Florent Chehab's avatar
Florent Chehab committed
98
eslint:
99
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
100
  stage: lint
101
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v2.0.0
Florent Chehab's avatar
Florent Chehab committed
102
  before_script:
103
    - cd frontend && mkdir -p node_modules && mv -f /usr/src/deps/node_modules/* /usr/src/deps/node_modules/.bin ./node_modules/
Florent Chehab's avatar
Florent Chehab committed
104
  script:
105
    - yarn lint
Florent Chehab's avatar
Florent Chehab committed
106
107
108
  tags:
    - docker

Florent Chehab's avatar
Florent Chehab committed
109
generate_UML_svg:
110
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
111
112
113
114
115
116
117
118
119
120
121
122
  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
123
pages:
124
  stage: documentation
125
  image: floawfloaw/plantuml
Florent Chehab's avatar
Florent Chehab committed
126
  dependencies:
Florent Chehab's avatar
Florent Chehab committed
127
    - test_back
Florent Chehab's avatar
Florent Chehab committed
128
    - generate_UML_svg
Florent Chehab's avatar
Florent Chehab committed
129
  script:
130
    - mkdir .public
131
    - mv backend/htmlcov/ .public/coverage
132
    - mv documentation/ .public/documentation
133
    - mv .public public
Florent Chehab's avatar
Florent Chehab committed
134
135
136
137
  artifacts:
    paths:
      - public
    expire_in: 1 month
Florent Chehab's avatar
Florent Chehab committed
138
  only:
139
    - dev
Florent Chehab's avatar
Florent Chehab committed
140
141
  tags:
    - docker