.gitlab-ci.yml 2.6 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
variables:
Florent Chehab's avatar
Florent Chehab committed
11 12
  ENV: DEV
  SECRET_KEY: stupid_key_for_CI
13 14
  DJANGO_ADMIN_USERNAME: admin
  DJANGO_ADMIN_PASSWORD: admin
Florent Chehab's avatar
Florent Chehab committed
15 16 17 18 19
  POSTGRES_DB: postgres
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: postgres
  DB_HOST: postgres
  DB_PORT: 5432
Florent Chehab's avatar
Florent Chehab committed
20

21 22 23 24
.only-default: &only-default
  only:
    - master
    - merge_requests
Florent Chehab's avatar
Florent Chehab committed
25 26

check_back:
27
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
28 29 30 31 32
  stage: check
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
  services:
    - postgres:10.5
  script:
33 34 35 36 37 38
    - 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
39 40 41 42
  tags:
    - docker

check_front:
43
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
44
  stage: check
45
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/frontend
Florent Chehab's avatar
Florent Chehab committed
46
  before_script:
47
    - cd frontend && cp -R /usr/src/deps/node_modules .
Florent Chehab's avatar
Florent Chehab committed
48 49 50 51 52 53
  script:
    - npm run build
  tags:
    - docker

test_back:
54
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
55
  stage: test
Florent Chehab's avatar
Florent Chehab committed
56
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
Florent Chehab's avatar
Florent Chehab committed
57
  services:
Florent Chehab's avatar
Florent Chehab committed
58
    - postgres:10.5
Florent Chehab's avatar
Florent Chehab committed
59
  script:
Florent Chehab's avatar
Florent Chehab committed
60
    - cd backend
Florent Chehab's avatar
Florent Chehab committed
61
    - pytest base_app/ backend_app/ --cov-report html
Florent Chehab's avatar
Florent Chehab committed
62 63
  artifacts:
    paths:
64
      - backend/htmlcov/
65
    expire_in: 1 hour
Florent Chehab's avatar
Florent Chehab committed
66 67 68
  tags:
    - docker

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

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

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

100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
generate_UML_svg:
  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
  only:
    - master
  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
Florent Chehab's avatar
Florent Chehab committed
130
  only:
Florent Chehab's avatar
Florent Chehab committed
131
    - master
Florent Chehab's avatar
Florent Chehab committed
132 133
  tags:
    - docker