This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
103 lines (94 loc) · 2.46 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
image: java:8-jdk
stages:
- test
- build
- deploy
before_script:
- echo `pwd`
- echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE"
- export GRADLE_USER_HOME=`pwd`/.gradle
- echo "$HOSTS_TEST" > "$(pwd)/deployment/environments/test/hosts"
- echo "$HOSTS_STAGE" > "$(pwd)/deployment/environments/stage/hosts"
- echo "$HOSTS_VARS" > "$(pwd)/deployment/vars.yml"
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
only:
- master
- tags
test:
stage: test
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:6.8.3
alias: elasticsearch
command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ]
script:
- ./gradlew test:cleanTest test:test
- ./gradlew search:cleanTest search:test
- ./gradlew web:cleanTest web:compileJava -x test
only:
changes:
- "**/*.java"
- "**/resources/*/*.json"
deploy:
stage: deploy
before_script:
- apt-get -qq update && apt-get -qq install -y python3
- apt-get -qq install -y python python-virtualenv python-pip
- virtualenv -p python3 .deployment
- source ./.deployment/bin/activate
- pip install -U setuptools
- pip install -r requirements.txt
script:
- cd deployment
- ansible-playbook deploy.xml -i environments/test
only:
- tags
except:
- branches
after_script:
- echo "Test deploy complete"
deploy-stage:
stage: deploy
before_script:
- apt-get -qq update && apt-get -qq install -y python3
- apt-get -qq install -y python python-virtualenv python-pip
- virtualenv -p python3 .deployment
- source ./.deployment/bin/activate
- pip install -U setuptools
- pip install -r requirements.txt
script:
- cd deployment
- ansible-playbook deploy.xml -i stage_host
only:
- tags
except:
- branches
after_script:
- echo "Stage deploy complete"
deploy-live:
stage: deploy
before_script:
- apt-get -qq update && apt-get -qq install -y python3
- apt-get -qq install -y python python-virtualenv python-pip
- virtualenv -p python3 .deployment
- source ./.deployment/bin/activate
- pip install -r requirements.txt
script:
- cd deployement
- ansible-playbook deploy.xml -i environments/prod
only:
- /^release-.*/
after_script:
- echo "LIVE deploy complete"
after_script:
- echo "End CI"