forked from Omnibyte27/Web-Collab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
53 lines (48 loc) · 1.35 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
image: docker:latest
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay
services:
- docker:dind
stages:
- build
- lint
- test
- deploy
#Run pylint_django on site/app code given default app/site folder names
pylint:
image: "$CI_REGISTRY_IMAGE:testing"
stage: lint
script:
- python -V
#Change paths to your project/app folders
- pylint --load-plugins pylint_django --disable=missing-docstring ./mysite/mysite
- pylint --load-plugins pylint_django --disable=missing-docstring ./mysite/myapp
#Build test container
build:
stage: build
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:testing .
- docker push $CI_REGISTRY_IMAGE:testing
#Run django unit testing/coverage generation on app code
test:
stage: test
image: "$CI_REGISTRY_IMAGE:testing"
script:
- cd /code
- coverage --version
- coverage run --source='.' ./manage.py test
- coverage report --skip-covered
#Create latest docker container if all the tests/lint passes on master
deploy:
only:
- master
stage: deploy
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:latest