.gitlab-ci.yml 2.75 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 22
  before_script:
    - make setup
Florent Chehab's avatar
Florent Chehab committed
23
  script:
24 25 26 27 28 29
    - 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
30 31 32 33
  tags:
    - docker

check_front:
34
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
35
  stage: check
36
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend:v0.1.0
Florent Chehab's avatar
Florent Chehab committed
37
  before_script:
38
    - cd frontend && cp -R /usr/src/deps/node_modules .
Florent Chehab's avatar
Florent Chehab committed
39 40 41 42 43 44
  script:
    - npm run build
  tags:
    - docker

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

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

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

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

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