-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
105 lines (99 loc) · 2.74 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
variables:
POSTGRES_DB: xsacdb
POSTGRES_USER: runner
POSTGRES_PASSWORD: "runner-password"
BSAC_DATA: "https://s3.amazonaws.com/xsacdb-bsac-data/bsac_data.yaml"
DOCKER_DRIVER: overlay2
stages:
- build
- test
- release
build:
stage: build
image: docker:19.03.1
before_script:
- apk add git
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG || docker pull wjdp/xsacdb:next || true
script:
- git describe
- docker build
--cache-from $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
--cache-from docker.io/wjdp/xsacdb:next
-t $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
--build-arg VCS_REV=$(git describe)
.
- docker push $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
django-test:
stage: test
image: $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
variables:
GIT_STRATEGY: none
XSACDB_ENVIRONMENT: TEST
XSACDB_XMLTESTRUNNER: 1
services:
- postgres:latest
- redis:latest
before_script:
- cd /app
- mkdir tmp
- curl $BSAC_DATA > tmp/bsac_data.yaml
- pip3 install coverage
script:
- src/manage.py check
- coverage run --source='src' src/manage.py test xSACdb xsd_about xsd_auth xsd_frontend xsd_help xsd_kit xsd_members xsd_sites xsd_training xsd_trips
- coverage report
after_script:
- mv /app/junit-django.xml $CI_PROJECT_DIR
coverage: '/^TOTAL.+?(\d+\%)$/'
artifacts:
paths:
- junit-django.xml
reports:
junit: junit-django.xml
eslint:
stage: test
image: $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
variables:
GIT_STRATEGY: none
before_script:
- cd /app
script:
- npm run lint:junit
after_script:
- mv /app/junit-eslint.xml $CI_PROJECT_DIR
artifacts:
paths:
- junit-eslint.xml
reports:
junit: junit-eslint.xml
release-next:
stage: release
image: docker:19.03.1
variables:
GIT_STRATEGY: none
before_script:
- docker pull $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_TOKEN
script:
- docker tag $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG wjdp/xsacdb:next
- docker push wjdp/xsacdb:next
only:
- master
except:
- tags
release-tag:
stage: release
image: docker:19.03.1
variables:
GIT_STRATEGY: none
before_script:
- docker pull $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_TOKEN
script:
- docker tag $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG wjdp/xsacdb:latest
- docker tag $CI_REGISTRY_IMAGE/ci:$CI_COMMIT_REF_SLUG wjdp/xsacdb:$CI_COMMIT_TAG
- docker push wjdp/xsacdb:latest
- docker push wjdp/xsacdb:$CI_COMMIT_TAG
only:
- /^v\d+[0-9A-z.-]+$/