-
Notifications
You must be signed in to change notification settings - Fork 65
/
.gitlab-ci.yml
242 lines (206 loc) · 6.57 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
stages:
- format
- docker_build
- build
- test
- release
- publish
- clean-up
include:
- gitlab/common.yml
- gitlab/python.yml
- gitlab/android.yml
- gitlab/ios.yml
- gitlab/docker.yml
## disables MR-triggered pipelines and allows only branch-triggered pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
test_format:
extends: .debian-image
stage: format
needs: []
script:
- ./tools/format.sh && git diff --exit-code
build_gcc_bullseye:
extends: .debian-image
stage: build
needs: [ test_format ]
script:
- ./tools/build.sh --gcc --buildtype release --no-deps-rebuild --external-deps-dir /prebuild/gcc --parallel 16 --enable-tests
- cmake --build build-gcc --target green_gdk_java --parallel 16
- cmake --install build-gcc --prefix install-java
- cmake --install build-gcc --prefix install-java --component gdk-java
artifacts:
expire_in: 2 hrs
paths:
- build-gcc/tests
- build-gcc/CTestTestfile.cmake
- install-java
test_gcc_bullseye:
extends: .debian-image
stage: test
needs: [build_gcc_bullseye]
script:
- cd build-gcc
- ctest
build_clang_bullseye:
extends: .debian-image
stage: build
needs: [ test_format ]
script:
- ./tools/build.sh --clang --buildtype release --no-deps-rebuild --external-deps-dir /prebuild/clang --parallel 16
- cmake --install build-clang --prefix install-clang
- cmake --install build-clang --prefix install-clang --component gdk-dev
artifacts:
expire_in: 2 hrs
paths:
- install-clang
test_rust:
extends: .debian-image
needs: []
stage: test
variables:
OPENSSL_DIR: "/prebuild/clang"
RUSTFLAGS: "-C instrument-coverage"
RUST_BACKTRACE: "1"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse"
script:
- cargo nextest run --profile ci --manifest-path subprojects/gdk_rust/Cargo.toml
- grcov --binary-path subprojects/gdk_rust/target/debug/ -t cobertura --branch --ignore-not-existing --ignore "*cargo*" -o coverage.xml -p `pwd` subprojects/gdk_rust
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
expire_in: 1 day
paths:
- subprojects/gdk_rust/target/nextest/ci/junit.xml
- coverage.xml
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: subprojects/gdk_rust/target/nextest/ci/junit.xml
allow_failure: true
rust_audit:
extends: .debian-image
needs: []
stage: test
allow_failure: true
script:
- cd subprojects/gdk_rust/
- cargo audit -D warnings --ignore RUSTSEC-2021-0127
build_clang_fedora:
extends: .fedora-image
stage: build
needs: [ test_format ]
script:
- source /root/.cargo/env
- ./tools/build.sh --clang --buildtype release --no-deps-rebuild --external-deps-dir /prebuild/clang --parallel 16
build_gcc_ubuntu20.04:
extends: .ubuntu-image
stage: build
needs: [ test_format ]
script:
- ./tools/build.sh --gcc --buildtype release --no-deps-rebuild --external-deps-dir /prebuild/gcc --parallel 16
build_gcc_ubuntu2004_arm64:
extends: .ubuntu-arm64-image
stage: build
needs: [ test_format ]
when: manual
script:
- source /root/.cargo/env
- ./tools/build.sh --gcc --buildtype release --no-deps-rebuild --external-deps-dir /prebuild/gcc --parallel 4 --static
- cmake --build build-gcc --target green_gdk_java --parallel 4
- cmake --install build-gcc --prefix install-java
- cmake --install build-gcc --prefix install-java --component gdk-java
artifacts:
expire_in: 2 hrs
paths:
- install-java
build_mingw64_windows:
extends: .debian-image
stage: build
needs: [ test_format ]
variables:
INSTALL_PATH: "install-gdk"
script:
- ./tools/build.sh --mingw-w64 --buildtype release --no-deps-rebuild --external-deps-dir /prebuild/mingw-w64 --parallel 16
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
expire_in: 1h
when: on_success
paths:
- build-windows-mingw-w64/archiver.sh
build_clang_osx:
extends:
- .osx_env
- .py_release
parallel:
matrix:
- RUNNER: [ia, m1]
tags:
- osx-$RUNNER
stage: build
needs: [ test_format ]
script:
- python3.9 -m venv venv
- source venv/bin/activate
- pip install -r ./tools/requirements.txt
- PREBUILT_DIR="$CI_BUILDS_DIR/$PREBUILT_SUBDIR/clang-osx"
- if [[ ! -d "$PREBUILT_DIR" ]]; then ./tools/builddeps.sh --parallel 16 --clang --prefix $PREBUILT_DIR; fi
- touch $CI_BUILDS_DIR/$PREBUILT_SUBDIR/last_use # marking last use to help out during sweeping operations
- ./tools/build.sh --clang --buildtype release --install $INSTALL_PATH --no-deps-rebuild --python-version venv --external-deps-dir $PREBUILT_DIR --parallel 16
- mkdir -p wheelhouse
- cp $INSTALL_PATH/share/python/* wheelhouse
apidocs:
extends: .debian-image
stage: build
needs: [ test_format ]
artifacts:
expire_in: 3 days
when: on_success
paths:
- apidocs.tar.gz
script:
- virtualenv -p python3 .venv
- source .venv/bin/activate
- pip3 install -r docs/requirements.txt
- sphinx-build -b html -a -c docs/source docs/source docs/build/html
- cd docs/build && tar czf ../../apidocs.tar.gz html/ && cd ../..
- deactivate
jumbo-release:
extends: .debian-image
stage: release
needs: [build-android, build_clang_bullseye, build_gcc_ubuntu2004_arm64]
artifacts:
expire_in: 7 days
when: on_success
paths:
- archive.tar.gz
script:
- suffix=${CI_COMMIT_TAG}
- if [ -z ${suffix} ]; then suffix=${CI_COMMIT_SHORT_SHA}; fi
- mkdir gdk-${suffix}
- cp -r install-clang/* gdk-${suffix}/
- cp -r install-java/lib/* gdk-${suffix}/lib
- cp -r gdk-android-jni/lib gdk-${suffix}/
- cp -r gdk-android-jni/share gdk-${suffix}/
- tar -czf archive.tar.gz gdk-${suffix} --remove-files
clean_osx:
stage: clean-up
parallel:
matrix:
- RUNNER: [ia, m1]
tags:
- osx-$RUNNER
needs: [ upload-ios-gcloud, upload-python-gcloud ]
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- cd $CI_BUILDS_DIR
- prebuilts=$(find . -name "prebuilt-*" -type d -maxdepth 1)
- for p in ${prebuilts[@]}; do if [ ! -f "$p/last_use" ]; then echo "removing $p";rm -rf $p; fi; done # old file format // TODO: remove in the future
- prebuilts=$(find . -name "prebuilt-*" -type d -maxdepth 1)
- for p in ${prebuilts[@]}; do elapsed=$(( `date +%s` - `stat -f "%m" "$p/last_use"` )); if [ "$elapsed" -gt "2592000" ]; then echo "removing $p"; rm -rf $p; fi; done