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

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

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

check_back:
16
  <<: *only-default
17
  stage: check_and_lint
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
37
  stage: check_and_lint
38
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v2.1.0
Florent Chehab's avatar
Florent Chehab committed
39
  before_script:
40
    - 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
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
  tags:
    - docker

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
flake8:
  <<: *only-default
  stage: check_and_lint
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
  script:
    - cd backend && flake8
  tags:
    - docker

eslint:
  <<: *only-default
  stage: check_and_lint
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v2.1.0
  before_script:
    - cd frontend && mkdir -p node_modules && mv -f /usr/src/deps/node_modules/* /usr/src/deps/node_modules/.bin ./node_modules/
  script:
    - yarn lint
  tags:
    - docker

    
Florent Chehab's avatar
Florent Chehab committed
71
test_back:
72
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
73
  stage: test
74
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
Florent Chehab's avatar
Florent Chehab committed
75
76
77
78
79
  variables:
    POSTGRES_DB: postgres
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres
    POSTGRES_HOST: postgres
80
    POSTGRES_PORT: 5432 # We absolutely need this one since a gitlab runner will inject a similar variable; will cause tests to fail.
81
82
    FIXER_API_TOKEN: 91ed43e97a55f9ed9a501cc005c15e9c
    UTC_API_ENDPOINT: http://192.168.122.1:8083/api
Florent Chehab's avatar
Florent Chehab committed
83
  services:
Florent Chehab's avatar
Florent Chehab committed
84
    - postgres:10.5
Florent Chehab's avatar
Florent Chehab committed
85
  before_script:
86
    - sh ./backend/init_logs.sh
Florent Chehab's avatar
Florent Chehab committed
87
    - make setup
Florent Chehab's avatar
Florent Chehab committed
88
  script:
Florent Chehab's avatar
Florent Chehab committed
89
    - cd backend
90
    - pytest base_app/ backend_app/ stats_app/ --cov --cov-config .coveragerc --cov-report term --cov-report html
Florent Chehab's avatar
Florent Chehab committed
91
92
  artifacts:
    paths:
93
      - backend/htmlcov/
Florent Chehab's avatar
Florent Chehab committed
94
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
95
96
97
  tags:
    - docker

98
test_frontend:
99
  <<: *only-default
100
  stage: test
101
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v2.1.0
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/
104
  script:
105
    - yarn test
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