-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
63 lines (56 loc) · 1.27 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
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true"
DOCKER_BUILDKIT: 1
IMAGE_NAME: kaloyankerr/fitsphere-backend
IMAGE_TAG: latest
stages:
- build
- test
- build_image
- sonar
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/wrapper
- .gradle/caches
- .m2/repository
build:
stage: build
script:
- ./gradlew assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
test:
stage: test
script:
- ./gradlew test jacocoTestReport
artifacts:
paths:
- build/customJacocoReportDir/test/jacocoTestReport.xml
- build/test-results/test/
expire_in: 1 week
build_image:
stage: build_image
services:
- docker:24.0.5-dind
before_script:
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
script:
- docker-compose build --no-cache
- docker-compose up -d
- docker tag fitsphere-backend ${IMAGE_NAME}:${IMAGE_TAG}
- docker push ${IMAGE_NAME}:${IMAGE_TAG}
sonar:
stage: sonar
script:
- ./gradlew sonar
dependencies:
- test
deploy:
stage: deploy
script:
- curl https://cli-assets.heroku.com/install.sh | sh
- heroku deploy:jar target/fitsphere-backend-1.0-SNAPSHOT.jar --app frozen-beyond-49936