-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
150 lines (135 loc) · 3.43 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
image: maven:latest
stages:
- build
- test
- code-quality
- deploy
variables:
RULES_CHANGES_PATH: "**/*"
.base-rules:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
- if: $CI_COMMIT_BRANCH == 'master'
when: always
- if: $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- $RULES_CHANGES_PATH
- when: manual
allow_failure: false
.backend:
extends: .base-rules
variables:
RULES_CHANGES_PATH: "backend/**/*"
.frontend:
extends: .base-rules
variables:
RULES_CHANGES_PATH: "frontend/**/*"
frontend-build:
image: node:16-alpine
stage: build
extends: .frontend
needs: [ ]
script:
- echo "building the frontend code..."
- cd frontend
- yarn install
- yarn build
build-backend:
stage: build
extends: .backend
needs: [ ]
script:
- cd backend
- mvn clean compile
test-backend:
stage: test
extends: .backend
needs: [ "build-backend" ]
script:
- cd backend
- mvn clean test -Dspring.profiles.active=test
frontend-test:
stage: test
image: node:16-alpine
extends: .frontend
needs: [ "frontend-build" ]
before_script:
- apk add chromium
- export CHROME_BIN=/usr/bin/chromium-browser
script:
- echo "Testing the frontend code..."
- cd frontend
- yarn install
- yarn test
backend-staging:
image: ruby:latest
stage: deploy
before_script:
- cd backend
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- dpl --provider=heroku --app=wanderergroup21 --api-key=$HEROKU_STAGING_API_KEY_BACKEND
only:
- develop
frontend-staging:
stage: deploy
image: ruby:latest
needs: [ "backend-staging" ]
before_script:
- cd frontend
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- dpl --provider=heroku --app=wanderergroup21frontend --api-key=$HEROKU_STAGING_API_KEY_BACKEND
only:
- develop
backend-staging-production:
image: ruby:latest
stage: deploy
before_script:
- cd backend
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- dpl --provider=heroku --app=wanderer-backend-live --api-key=$HEROKU_STAGING_API_KEY_BACKEND
only:
- master
frontend-staging-production:
stage: deploy
image: ruby:latest
needs: [ "backend-staging-production" ]
before_script:
- cd frontend
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- dpl --provider=heroku --app=wanderer-live --api-key=$HEROKU_STAGING_API_KEY_BACKEND
only:
- master
backend-code-quality:
stage: code-quality
image: maven:3-jdk-11
variables:
UPLOAD_QUALITY_REPORT: 'curl -X PUT -H "Authorization: Token $QSCORED_API_KEY" + -H "username:patel.janvi23798@gmail.com" -H "Content-Type: application/xml" --url "https://qscored.com/api/upload/file.xml?is_open_access=off&version=$CI_PIPELINE_IID&project_name=wanderer_backend" -F "file=@DesigniteAnalysis.xml"'
before_script:
- cd backend
- apt-get update
- apt-get install -y wget curl
- wget -O DesigniteJava.jar https://www.dropbox.com/s/mwizkj8uhplz4x3/DesigniteJava.jar?dl=1
script:
- java -jar DesigniteJava.jar -i ./ -o code-quality/ -f XML
- ls -l
- ls code-quality
- cd code-quality
- eval "$UPLOAD_QUALITY_REPORT"
- echo "$UPLOAD_QUALITY_REPORT"
only:
- develop