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

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
21
  before_script:
22
    - sh ./backend/init_logs.sh
23
    - make setup
Florent Chehab's avatar
Florent Chehab committed
24
  script:
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
Florent Chehab's avatar
Florent Chehab committed
31 32 33 34
  tags:
    - docker

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

test_back:
50
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
51
  stage: test
52
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:v0.2.1
53 54 55 56 57 58
  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.
Florent Chehab's avatar
Florent Chehab committed
59
  services:
Florent Chehab's avatar
Florent Chehab committed
60
    - postgres:10.5
61
  before_script:
62
    - sh ./backend/init_logs.sh
63
    - make setup
Florent Chehab's avatar
Florent Chehab committed
64
  script:
Florent Chehab's avatar
Florent Chehab committed
65
    - cd backend
Florent Chehab's avatar
Florent Chehab committed
66
    - pytest base_app/ backend_app/ --cov --cov-config .coveragerc --cov-report term --cov-report html
Florent Chehab's avatar
Florent Chehab committed
67 68
  artifacts:
    paths:
69
      - backend/htmlcov/
70
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
71 72 73
  tags:
    - docker

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

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

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

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