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

Florent Chehab's avatar
Florent Chehab committed
10

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

Florent Chehab's avatar
Florent Chehab committed
16

Florent Chehab's avatar
Florent Chehab committed
17
check_back:
18
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
19
  stage: check
20
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
Florent Chehab's avatar
Florent Chehab committed
21
  before_script:
22
    - sh ./backend/init_logs.sh
Florent Chehab's avatar
Florent Chehab committed
23
    - make setup
Florent Chehab's avatar
Florent Chehab committed
24
  script:
Florent Chehab's avatar
Florent Chehab committed
25
26
27
28
29
30
    - 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
31
32
33
  variables:
    FIXER_API_TOKEN: 91ed43e97a55f9ed9a501cc005c15e9c
    UTC_API_ENDPOINT: http://192.168.122.1:8083/api
Florent Chehab's avatar
Florent Chehab committed
34
35
36
37
  tags:
    - docker

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

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

79
test_frontend:
80
  <<: *only-default
81
  stage: test
82
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v0.5.0
83
  before_script:
84
    - cd frontend && cp -R /usr/src/deps/node_modules .
85
86
87
88
89
  script:
    - npm run test
  tags:
    - docker

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

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

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