-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path.gitlab-ci.yml
289 lines (269 loc) · 9.64 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
include:
- project: sysadmin/ci-utilities
file:
- /gitlab-templates/blocks/workflow.yml
.tox_base:
image: python:3.11
tags:
- Linux
interruptible: true
before_script:
- python --version
- python -m venv .venv
- source .venv/bin/activate
- pip install tox
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit-*.xml
lint:
extends: .tox_base
script: tox -e lint
imports:
extends: .tox_base
script: tox -e check-imports
run-tests:
stage: test
image: python:latest
tags:
- Linux
interruptible: true
before_script:
- python3 --version # For debugging
- pip install virtualenv
- mkdir /tmp/craft_test
- cd /tmp/craft_test
- virtualenv venv
- source venv/bin/activate
- pip install unittest-xml-reporting
script:
- cd /tmp/craft_test
- craftBranch=master
- echo "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME"
- |
if [ "$CI_COMMIT_REF_NAME" = "dev" ]; then
craftBranch=dev
fi
- echo "CI_MERGE_REQUEST_TARGET_BRANCH_NAME=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- |
if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" = "dev" ]; then
craftBranch=dev
fi
- echo "Going to checkout branch $craftBranch of craft-core"
- git clone --depth 1 -b $craftBranch https://invent.kde.org/packaging/craft.git
- mkdir blueprints
- blueprintRoot=$(pwd)/blueprints/
- "echo blueprintRoot: $blueprintRoot"
- ln -s $CI_PROJECT_DIR $blueprintRoot/craft-blueprints-kde
- python3 craft/bin/test/runtests.py --blueprint-root $blueprintRoot
artifacts:
reports:
junit: JUnit*Results.xml
.build-package-base:
variables:
GIT_STRATEGY: none
KDECI_CRAFT_PLATFORM: linux-64-gcc
KDECI_CRAFT_CACHE: /mnt/craft-cache/$KDECI_CRAFT_PLATFORM/
KDECI_CRAFT_CONFIG: ci-utilities/craft/qt6/CraftConfig.ini
CRAFT_PACKAGE:
rules:
- if: $CI_COMMIT_REF_NAME == "dev"
when: manual
variables:
KDECI_CRAFT_CONFIG: ci-utilities/craft/qt6-dev/CraftConfig.ini
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"
when: manual
variables:
KDECI_CRAFT_CONFIG: ci-utilities/craft/qt6-dev/CraftConfig.ini
- when: manual
# we don't want the manual job to block the pipeline
allow_failure: true
interruptible: true
build-package-linux:
# This job can be used to test the build of a package, e.g. when you update
# the package to a new version. Set CRAFT_PACKAGE to the package you want to
# test. This test uses the CI image that's also used for the AppImages.
extends: .build-package-base
image: invent-registry.kde.org/sysadmin/ci-images/sles15-craft:latest
tags:
- Linux
variables:
KDECI_CRAFT_PLATFORM: linux-64-gcc
before_script:
- if [ -z "$CRAFT_PACKAGE" ]; then echo "Error - Set CRAFT_PACKAGE to the package you want to test."; false; fi
- export LANG=en_US.UTF-8
- git clone https://invent.kde.org/packaging/craftmaster.git --branch=master
- git clone https://invent.kde.org/sysadmin/ci-utilities.git --depth=1
# Define a short cut for the lengthy CraftMaster command line
- function craftmaster { python3 craftmaster/CraftMaster.py --config $KDECI_CRAFT_CONFIG --target $KDECI_CRAFT_PLATFORM $@; }
script:
# Set up craft settings and blueprint settings
- craftmaster --setup
# Get Craft itself ready
- craftmaster -c -i --options virtual.ignored=True --update craft
- craftmaster -c craft
# Switch to this branch of craft-blueprints-kde
- cd $CI_PROJECT_DIR/blueprints/craft-blueprints-kde
- git checkout $CI_COMMIT_REF_NAME
- cd $CI_PROJECT_DIR
# Install all of our dependencies
- craftmaster -c --install-deps $CRAFT_PACKAGE
# Build the package
- craftmaster -c --no-cache $CRAFT_PACKAGE
artifacts:
expire_in: 3 days
when: always
paths:
- "$KDECI_CRAFT_PLATFORM/logs/"
.build-package-windows_qt6:
# This job can be used to test the build of a package, e.g. when you update
# the package to a new version. Set CRAFT_PACKAGE to the package you want to
# test. This test uses the CI image that's used for the craft_windows_qt6_x86_64 job.
extends: .build-package-base
image: invent-registry.kde.org/sysadmin/ci-images/windows-msvc2022:latest
tags:
- Windows
variables:
PYTHONUTF8: 1
KDECI_CRAFT_CACHE: C:/Gitlab/Craft/download/
before_script:
- cd C:\Gitlab\Craft\
- Get-ChildItem C:\Gitlab\Craft\ | Remove-Item -Recurse -Force
- git clone https://invent.kde.org/packaging/craftmaster.git --branch=master
- git clone https://invent.kde.org/sysadmin/ci-utilities.git --depth=1
# Define a short cut for the lengthy CraftMaster command line
- |
function Run-CraftMaster {
python craftmaster/CraftMaster.py --config $env:KDECI_CRAFT_CONFIG --target $env:KDECI_CRAFT_PLATFORM $args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
script:
# Set up craft settings and blueprint settings
- Run-CraftMaster --setup
# Get Craft itself ready
- Run-CraftMaster -c -i --options virtual.ignored=True --update craft
- Run-CraftMaster -c craft
# Switch to this branch of craft-blueprints-kde
- cd C:/Gitlab/Craft/blueprints/craft-blueprints-kde
- git checkout $env:CI_COMMIT_REF_NAME
- cd C:/Gitlab/Craft
# Install all of our dependencies
- Run-CraftMaster -c --install-deps --options "[CodeSigning]Enabled=False" $env:CRAFT_PACKAGE
# Build the package
- Run-CraftMaster -c --no-cache --options "[CodeSigning]Enabled=False" $env:CRAFT_PACKAGE
after_script:
- if (!(Test-Path $env:CI_PROJECT_DIR/.logs)) { New-Item $env:CI_PROJECT_DIR/.logs -ItemType directory }
- Copy-item -Path C:/Gitlab/Craft/$env:KDECI_CRAFT_PLATFORM/logs/* -Destination $env:CI_PROJECT_DIR/.logs/ -Recurse
artifacts:
expire_in: 3 days
when: always
paths:
- ".logs/"
build-package-windows_qt6_x86_64:
extends: .build-package-windows_qt6
variables:
KDECI_CRAFT_PLATFORM: windows-msvc2022_64-cl
artifacts:
expire_in: 3 days
when: always
paths:
- ".logs/"
build-package-windows_qt6_mingw64:
extends: .build-package-windows_qt6
variables:
KDECI_CRAFT_PLATFORM: windows-mingw_64-gcc
artifacts:
expire_in: 3 days
when: always
paths:
- ".logs/"
.build-package-macos_qt6:
extends: .build-package-base
tags:
- macOS
before_script:
# ensure we start with an empty folder
- rm -rf *
- export LANG=en_US.UTF-8
- git clone https://invent.kde.org/packaging/craftmaster.git --branch=master
- git clone https://invent.kde.org/sysadmin/ci-utilities.git --depth=1
# Define a short cut for the lengthy CraftMaster command line
- function craftmaster { python3 craftmaster/CraftMaster.py --config $KDECI_CRAFT_CONFIG --target $KDECI_CRAFT_PLATFORM $@; }
script:
# Set up craft settings and blueprint settings
- craftmaster --setup
# Get Craft itself ready
- craftmaster -c -i --options virtual.ignored=True --update craft
# Switch to this branch of craft-blueprints-kde
- cd $CI_PROJECT_DIR/blueprints/craft-blueprints-kde
- git checkout $CI_COMMIT_REF_NAME
- cd $CI_PROJECT_DIR
# Install all of our dependencies
- craftmaster -c --install-deps --options "[CodeSigning]Enabled=False" $CRAFT_PACKAGE
# Build the actual application
- craftmaster -c --no-cache --options "[CodeSigning]Enabled=False" $CRAFT_PACKAGE
after_script:
# Move logs to protect them against cleanup deletion
- mkdir $CI_PROJECT_DIR/kde-ci-logs/
- cp -f -R $KDECI_CRAFT_PLATFORM/logs/. $CI_PROJECT_DIR/kde-ci-logs/
# cleanup, we can't just delete everything since that would also delete the artifacts which are gathered after
- rm -rf src craftmaster ci-utilities blueprints downloads craft-clone $KDECI_CRAFT_PLATFORM
artifacts:
expire_in: 3 days
when: always
paths:
- "kde-ci-logs/"
build-package-macos_qt6_arm64:
extends: .build-package-macos_qt6
variables:
KDECI_CRAFT_PLATFORM: macos-arm-clang
artifacts:
expire_in: 3 days
when: always
paths:
- "kde-ci-logs/"
build-package-macos_qt6_x86_64:
extends: .build-package-macos_qt6
variables:
KDECI_CRAFT_PLATFORM: macos-64-clang
artifacts:
expire_in: 3 days
when: always
paths:
- "kde-ci-logs/"
.build-package-android_qt6:
extends: .build-package-base
image: invent-registry.kde.org/sysadmin/ci-images/android-qt68:latest
tags:
- Linux
before_script:
- git clone https://invent.kde.org/packaging/craftmaster.git --branch=master
- git clone https://invent.kde.org/sysadmin/ci-utilities.git --depth=1
# Define a short cut for the lengthy CraftMaster command line
- function craftmaster { python3 craftmaster/CraftMaster.py --config $KDECI_CRAFT_CONFIG --target $KDECI_CRAFT_PLATFORM $@; }
script:
# Set up craft settings and blueprint settings
- craftmaster --setup
# Get Craft itself ready
- craftmaster -c -i craft
# Switch to this branch of craft-blueprints-kde
- cd $CI_PROJECT_DIR/blueprints/craft-blueprints-kde
- git checkout $CI_COMMIT_REF_NAME
- cd $CI_PROJECT_DIR
# Install all of our dependencies
- craftmaster -c --install-deps --options "[CodeSigning]Enabled=False" $CRAFT_PACKAGE
# Build the actual application
- craftmaster -c --no-cache --options "[CodeSigning]Enabled=False" $CRAFT_PACKAGE
build-package-android_qt6_arm64:
extends: .build-package-android_qt6
variables:
KDECI_CRAFT_PLATFORM: android-arm64-clang
artifacts:
expire_in: 3 days
when: always
paths:
- "$KDECI_CRAFT_PLATFORM/logs/"