-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
265 lines (247 loc) · 7.8 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
#cache:
# paths:
# - target/
stages:
- build
- test
- deploy
- post-run
# our own git fetch command like https://gitlab.com/gitlab-org/gitlab-runner/blob/master/shells/abstract.go
# speeds up building because we skip the git clean and dont need any gitlab caches
variables:
GIT_STRATEGY: none
before_script:
- if [ -d .git ]; then
echo "is git dir";
else
git clone $CI_REPOSITORY_URL . ;
fi;
- rm -f .git/index.lock
- rm -f .git/shallow.lock
- rm -f .git/HEAD.lock
- rm -f .git/hocks/post-checkout
- git remote set-url origin $CI_REPOSITORY_URL
- git fetch origin --prune +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
- git checkout -f -q $CI_COMMIT_SHA
- if [ ! -z "${SOURCE_PROJECT}" -a "${SOURCE_PROJECT}" != " " ]; then
echo "THIS SEEMS TO BE A MERGE PIPELINE FROM ${SOURCE_PROJECT}/${SOURCE_BRANCH}";
git pull "https://gitlab.com/${SOURCE_PROJECT}/game.git" "${SOURCE_BRANCH}";
fi;
- git submodule update --init --recursive
- git status
- if [ -d target ]; then
ls -la target;
fi;
# - git submodule update --init --recursive
clean-code:
stage: build
script:
- rustup component add rustfmt-preview
- cargo fmt --all -- --check
build-voxygen:
stage: build
script:
- (cd voxygen && cargo build)
build-headless:
stage: build
script:
- (cd headless && cargo build)
build-server-cli:
stage: build
script:
- (cd server-cli && cargo build)
build-login-cli:
stage: build
script:
- (cd login-cli && cargo build)
unittests:
stage: test
script:
- cargo test
#benchmarktests:
# stage: test
# script:
# - cargo bench
nightly-linux-debug:
stage: deploy
script:
- (cd voxygen && cargo build)
- (cd server-cli && cargo build)
- (cd headless && cargo build)
- rm -r -f nightly/client
- rm -r -f nightly
- mkdir nightly
- mkdir nightly/client
- cp target/debug/server-cli nightly/client/
- cp target/debug/voxygen nightly/client/
- cp target/debug/headless nightly/client/
- cp -r voxygen/assets nightly/
- cp -r voxygen/shaders nightly/client/
- rm -f nightly-linux-debug.tar.bz2
- tar -cvjSf nightly-linux-debug.tar.bz2 nightly
when: always
artifacts:
paths:
- nightly-linux-debug.tar.bz2
expire_in: 1 week
only:
refs:
- master
nightly-windows-debug:
stage: deploy
script:
- (cd voxygen && cargo build --target=x86_64-pc-windows-gnu)
- (cd server-cli && cargo build --target=x86_64-pc-windows-gnu)
- (cd headless && cargo build --target=x86_64-pc-windows-gnu)
- rm -r -f nightly/client
- rm -r -f nightly
- mkdir nightly
- mkdir nightly/client
- cp target/x86_64-pc-windows-gnu/debug/server-cli.exe nightly/client/
- cp target/x86_64-pc-windows-gnu/debug/voxygen.exe nightly/client/
- cp target/x86_64-pc-windows-gnu/debug/headless.exe nightly/client/
- cp -r voxygen/assets nightly/
- cp -r voxygen/shaders nightly/client/
- rm -f nightly-windows-debug.zip
- zip -r nightly-windows-debug.zip nightly
artifacts:
paths:
- nightly-windows-debug.zip
expire_in: 1 week
only:
refs:
- master
nightly-linux-optimized:
stage: deploy
script:
- (cd voxygen && cargo build --release)
- (cd server-cli && cargo build --release)
- (cd headless && cargo build --release)
- rm -r -f nightly/client
- rm -r -f nightly
- mkdir nightly
- mkdir nightly/client
- cp target/release/server-cli nightly/client/
- cp target/release/voxygen nightly/client/
- cp target/release/headless nightly/client/
- cp -r voxygen/assets nightly/
- cp -r voxygen/shaders nightly/client/
- rm -f nightly-linux-optimized.tar.bz2
- tar -cvjSf nightly-linux-optimized.tar.bz2 nightly
when: manual
artifacts:
paths:
- nightly-linux-optimized.tar.bz2
expire_in: 2 days
only:
refs:
- master
nightly-windows-optimized:
stage: deploy
script:
- (cd voxygen && cargo build --release --target=x86_64-pc-windows-gnu)
- (cd server-cli && cargo build --release --target=x86_64-pc-windows-gnu)
- (cd headless && cargo build --release --target=x86_64-pc-windows-gnu)
- rm -r -f nightly/client
- rm -r -f nightly
- mkdir nightly
- mkdir nightly/client
- cp target/x86_64-pc-windows-gnu/release/server-cli.exe nightly/client/
- cp target/x86_64-pc-windows-gnu/release/voxygen.exe nightly/client/
- cp target/x86_64-pc-windows-gnu/release/headless.exe nightly/client/
- cp -r voxygen/assets nightly/
- cp -r voxygen/shaders nightly/client/
- rm -f nightly-windows-optimized.zip
- zip -r nightly-windows-optimized.zip nightly
when: manual
artifacts:
paths:
- nightly-windows-optimized.zip
expire_in: 2 days
only:
refs:
- master
stable-linux-optimized:
stage: deploy
script:
- (cd voxygen && cargo build --release)
- (cd server-cli && cargo build --release)
- (cd headless && cargo build --release)
- rm -r -f stable/client
- rm -r -f stable
- mkdir stable
- mkdir stable/client
- cp target/release/server-cli stable/client/
- cp target/release/voxygen stable/client/
- cp target/release/headless stable/client/
- cp -r voxygen/assets stable/
- cp -r voxygen/shaders nightly/client/
- rm -f stable-linux-optimized.tar.bz2
- tar -cvjSf stable-linux-optimized.tar.bz2 stable
artifacts:
paths:
- stable-linux-optimized.tar.bz2
expire_in: 30d
only:
refs:
- /^v[0-9]+\.[0-9]+\.[0-9]+/
stable-windows-optimized:
stage: deploy
script:
- (cd voxygen && cargo build --release --target=x86_64-pc-windows-gnu)
- (cd server-cli && cargo build --release --target=x86_64-pc-windows-gnu)
- (cd headless && cargo build --release --target=x86_64-pc-windows-gnu)
- rm -r -f stable/client
- rm -r -f stable
- mkdir stable
- mkdir stable/client
- cp target/x86_64-pc-windows-gnu/release/server-cli.exe stable/client/
- cp target/x86_64-pc-windows-gnu/release/voxygen.exe stable/client/
- cp target/x86_64-pc-windows-gnu/release/headless.exe stable/client/
- cp -r voxygen/assets stable/
- cp -r voxygen/shaders nightly/client/
- rm -f stable-windows-optimized.zip
- zip -r stable-windows-optimized.zip stable
artifacts:
paths:
- stable-windows-optimized.zip
expire_in: 30d
only:
refs:
- /^v[0-9]+\.[0-9]+\.[0-9]+/
# nightly-windows-release:
# stage: deploy
# script:
# - (cd voxygen && cargo build --release --target=x86_64-pc-windows-gnu)
# - (cd server-cli && cargo build --release --target=x86_64-pc-windows-gnu)
# - (cd headless && cargo build --release --target=x86_64-pc-windows-gnu)
# - rm -r -f nightly
# - mkdir nightly
# - cp target/x86_64-pc-windows-gnu/debug/server-cli.exe nightly
# - cp target/x86_64-pc-windows-gnu/debug/voxygen.exe nightly
# - cp target/x86_64-pc-windows-gnu/debug/headless.exe nightly
# - cp -r voxygen/assets nightly/
# - rm -f nightly-windows-release.zip
# - zip -r nightly-windows-release.zip nightly
# artifacts:
# paths:
# - nightly-windows-release.zip
# expire_in: 1 week
# only:
# refs:
# - master
coverage:
stage: post-run
script:
- if cargo install --list | grep -i "cargo-tarpaulin"; then
echo "tarpaulin already installed";
else
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin;
fi
- cargo tarpaulin --skip-clean --all --exclude headless || echo "There is a problem in tarpaulin which sometimes fails"
clippy:
stage: post-run
script:
- rustup component add clippy-preview --toolchain=nightly
- cargo clippy --all -- -D clippy || echo "This job is disabled, because we are not activly using it now, so we dont want to see yellow failed partly"
allow_failure: true