.gitlab-ci.yml 2.54 KB
Newer Older
1
stages:
Florent Chehab's avatar
Florent Chehab committed
2
  - check
3
  - test
Florent Chehab's avatar
Florent Chehab committed
4
  - lint
5
  - svg-gen-docu # required to be done before documentation and in separate stages
6
  - documentation
7

Florent Chehab's avatar
Florent Chehab committed
8
variables:
Florent Chehab's avatar
Florent Chehab committed
9 10
  ENV: DEV
  SECRET_KEY: stupid_key_for_CI
11 12
  DJANGO_ADMIN_USERNAME: admin
  DJANGO_ADMIN_PASSWORD: admin
Florent Chehab's avatar
Florent Chehab committed
13 14 15 16 17
  POSTGRES_DB: postgres
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: postgres
  DB_HOST: postgres
  DB_PORT: 5432
Florent Chehab's avatar
Florent Chehab committed
18

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

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

check_front:
41
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
42 43 44 45 46 47 48 49 50 51 52 53 54
  stage: check
  image: node:10.15.1-alpine
  cache:
    paths:
      - frontend/node_modules/
  before_script:
    - cd frontend && npm i
  script:
    - npm run build
  tags:
    - docker

test_back:
55
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
56
  stage: test
Florent Chehab's avatar
Florent Chehab committed
57
  image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend
Florent Chehab's avatar
Florent Chehab committed
58
  services:
Florent Chehab's avatar
Florent Chehab committed
59
    - postgres:10.5
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-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 73 74 75 76 77 78 79 80 81 82 83
  stage: test
  image: node:10.15.1-alpine
  cache:
    paths:
      - frontend/node_modules/
  before_script:
    - cd frontend && npm i
  script:
    - npm run test
  tags:
    - docker

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

Florent Chehab's avatar
Florent Chehab committed
93
eslint:
94
  <<: *only-default
Florent Chehab's avatar
Florent Chehab committed
95 96 97 98 99 100 101
  stage: lint
  image: node:10.15.1-alpine
  cache:
    paths:
      - frontend/node_modules/
  before_script:
    - cd frontend && npm i
Florent Chehab's avatar
Florent Chehab committed
102
  script:
Florent Chehab's avatar
Florent Chehab committed
103
    - npm run lint
Florent Chehab's avatar
Florent Chehab committed
104 105 106
  tags:
    - docker

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