-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
166 lines (153 loc) · 4.08 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
stages:
- docker
- lint
- dependencies
- build
- test
default:
image: $CI_REGISTRY_IMAGE:latest
tags:
- IP34-21vt_Lernstick
checkspell:
stage: lint
script:
- checkstyle -c config/checkstyle/checks.xml src/
lineendings:
image: alpine
stage: lint
script:
- apk add --no-cache file findutils
- (! find -regex '.*\.\(css\|f?xml\|java\|md\|properties\|svg\|txt\)$' -type f -exec file '{}' \; | grep -F 'CRLF')
xmllint:
image: alpine
stage: lint
script:
- apk add --no-cache findutils libxml2-utils
- find -regex '.*\.f?xml$' -type f -exec xmllint --format --noout '{}' \;
- find src/main/resources/fxml -not \( -name controls -prune \) -type f -name '*.fxml' | xargs -t -L1 xmllint --xpath '/*[namespace-uri()="http://javafx.com/javafx/11"]' > /dev/null
.prepare:
before_script:
- mkdir -p nbproject/private
- |
cat << EOF > nbproject/private/private.properties
project.JBackpack=jbackpack
project.lernstickTools=lernstickTools
reference.lernstickTools.jar=\${project.lernstickTools}/build/libs/lernstickTools.jar
EOF
ci:
image: docker
stage: docker
variables:
CI_REGISTRY: cr.gitlab.fhnw.ch
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
services:
- name: docker:dind
alias: docker
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
script:
- docker build --pull -t $IMAGE_TAG ci
- docker images
- docker push $IMAGE_TAG
only:
- schedules
build:lernstickTools:
extends: .prepare
stage: dependencies
script:
- git clone --depth=10 https://github.com/Lernstick/lernstickTools
- cd lernstickTools
- gradle build
artifacts:
paths:
- lernstickTools/build/libs/lernstickTools.jar
build:jbackpack:
extends: .prepare
stage: dependencies
script:
- git clone --depth=10 https://github.com/Lernstick/jbackpack
- cd jbackpack
- ant jar
artifacts:
paths:
- jbackpack/dist
build:storage-media-management:
extends: .prepare
stage: build
script:
- ant jar
dependencies:
- build:lernstickTools
- build:jbackpack
artifacts:
paths:
- dist
- build/classes
build:storage-media-management:javadoc:
extends: .prepare
stage: build
script:
- ant javadoc
dependencies:
- build:lernstickTools
- build:jbackpack
artifacts:
paths:
- dist/javadoc
build:storage-media-management:deb:
extends: .prepare
stage: build
script:
- apt-get update
- apt-get install -y --no-install-recommends build-essential debhelper junit
- dpkg-buildpackage --no-sign
- mkdir dpkg
- mv ../dlcopy* dpkg/
dependencies:
- build:lernstickTools
- build:jbackpack
artifacts:
paths:
- dpkg
sonarqube-warn:
stage: test
image:
name: sonarsource/sonar-scanner-cli
entrypoint: ['']
variables:
GIT_DEPTH: '0'
SONAR_HOST_URL: ${CI_SONARQUBE_HOST_URL}
SONAR_PROJECT: ${CI_SONARQUBE_PROJECT}
SONAR_TOKEN: ${CI_SONARQUBE_TOKEN}
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
dependencies:
- build:storage-media-management
script:
- >
sonar-scanner
-Dsonar.gitlab.commit_sha=$CI_BUILD_REF
-Dsonar.gitlab.ref_name=$CI_BUILD_REF_NAME
-Dsonar.host.url="${CI_SONARQUBE_HOST_URL}"
-Dsonar.java.binaries=build/classes
-Dsonar.login="${CI_SONARQUBE_TOKEN}"
-Dsonar.projectKey="${CI_SONARQUBE_PROJECT}"
-Dsonar.qualitygate.wait=true
-Dsonar.sources=src
# fine graded options are a paid feature.
allow_failure: true
testfx:
extends: .prepare
stage: test
script:
- apt-get update
- apt-get install -y --no-install-recommends junit libmockito-java xauth xvfb
# Create files for tricking the Storage media management into thinking to run on a Lerstick instance
# See `src/main/java/ch/fhnw/dlcopy/DebianLiveVersion.java` for more infomration
- mkdir -pv /run/live/medium
- mkdir -pv /usr/lib/syslinux/mbr
- touch /usr/lib/syslinux/mbr/mbr.bin
- xvfb-run ant test