.gitlab-ci.yml 2.81 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.3.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 42 43 44 45
  script:
    - npm run build
  tags:
    - docker

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

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

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

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

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