-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
167 lines (147 loc) · 4.11 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
include:
- project: "ExplorViz/code/deployment"
file: ".gitlab-ci-explorviz-common.yml"
default:
tags:
- exec-docker
image: ghcr.io/graalvm/graalvm-community:21
cache: # Cache modules in between jobs
key: $CI_COMMIT_REF_SLUG
paths:
- .gradle
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
when: never
- if: "$CI_COMMIT_BRANCH"
stages:
- build
- code-analysis
- test
- coverage
- visualize
- deploy:images
- deploy:retagging
build:
stage: build
script: ./gradlew --build-cache assemble
cache:
policy: push
paths:
- .gradle
artifacts:
paths:
- build
pmd:
stage: code-analysis
script: ./gradlew pmdMain
checkstyle:
stage: code-analysis
script: ./gradlew checkstyleMain
test:
stage: test
script:
- ./gradlew test
- ./gradlew jacocoTestReport
# Print test coverage to console (for coverage badge)
- cat build/reports/jacoco/test/html/index.html | grep -o 'Total[^%]*%' | sed 's/<.*>/ /; s/Total/Jacoco Coverage Total:/'
coverage: "/Jacoco Coverage Total: ([0-9]{1,3})%/"
artifacts:
when: always
reports:
junit: build/test-results/test/**/TEST-*.xml
paths:
- build/reports/jacoco/test/jacocoTestReport.xml
integration-test:
stage: test
tags:
- podman
allow_failure: true
script:
- DOCKER_HOST="unix:///run/user/$UID/podman/podman.sock" TESTCONTAINERS_RYUK_DISABLED=true TESTCONTAINERS_CHECKS_DISABLE=true ./gradlew integrationTest
- ./gradlew jacocoTestReport
# Print test coverage to console (for coverage badge)
- cat build/reports/jacoco/test/html/index.html | grep -o 'Total[^%]*%' | sed 's/<.*>/ /; s/Total/Jacoco Coverage Total:/'
coverage: "/Jacoco Coverage Total: ([0-9]{1,3})%/"
dependencies:
- test
artifacts:
when: always
reports:
junit: build/test-results/**/TEST-*.xml
paths:
- build/reports/jacoco/test/jacocoTestReport.xml
coverage:
stage: visualize
image: registry.gitlab.com/haynes/jacoco2cobertura:1.0.7
script:
# convert report from jacoco to cobertura
- "python /opt/cover2cover.py build/reports/jacoco/test/jacocoTestReport.xml src/main/java > build/cobertura.xml"
# read the <source></source> tag and prepend the path to every filename attribute
- "python /opt/source2filename.py build/cobertura.xml"
needs: ["test"]
dependencies:
- test
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: build/cobertura.xml
push-dockerhub-native-main-amd64:
extends: .build-and-deploy-quarkus-native
variables:
IMAGE_TAG: "amd64"
push-dockerhub-native-main-arm64:
extends: .build-and-deploy-quarkus-native
rules:
- if: $MULTI_ARCH_BUILD || $ARM64_BUILD
variables:
IMAGE_TAG: "arm64"
tags:
- arm64
push-dockerhub-native-mr:
extends: .build-and-deploy-quarkus-native
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
IMAGE_TAG: mr-${CI_MERGE_REQUEST_IID}-native
push-dockerhub-main-amd64:
extends: .build-and-deploy-quarkus-jvm
variables:
IMAGE_TAG: "amd64"
push-dockerhub-main-arm64:
extends: .build-and-deploy-quarkus-jvm
rules:
- if: $MULTI_ARCH_BUILD || $ARM64_BUILD
variables:
IMAGE_TAG: "arm64"
tags:
- arm64
push-dockerhub-mr:
extends: .build-and-deploy-quarkus-jvm
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
IMAGE_TAG: mr-${CI_MERGE_REQUEST_IID}-jvm
retag-amd64-as-latest-jvm:
extends: .retag-dockerhub-image
variables:
SOURCE_TAG: "amd64"
TARGET_TAG: "latest"
retag-amd64-as-latest-native:
extends: .retag-dockerhub-image
variables:
IMAGE_NAME: $DOCKERHUB_IMAGE_NAME_NATIVE
SOURCE_TAG: "amd64"
TARGET_TAG: "latest"
publish-multi-arch-manifest-jvm:
extends: .retag-as-multi-arch-dockerhub-image
publish-multi-arch-manifest-native:
extends: .retag-as-multi-arch-dockerhub-image
variables:
IMAGE_NAME: $DOCKERHUB_IMAGE_NAME_NATIVE