-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
402 lines (361 loc) · 9.53 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
###############################################
# Define stages of the CI
###############################################
stages:
- lint
- test
- deploy
###############################################
# Define the package variables for the tests
###############################################
variables:
legacy_pkgs: >-
./node
./node/api
./node/api/server
package_host_pkgs: >-
./modules/host
./modules/host/contractmanager
./modules/host/mdm
package_renter_pkgs: >-
./modules/renter
./modules/renter/contractor
./modules/renter/filesystem
./modules/renter/filesystem/siafile
./modules/renter/filesystem/siadir
./modules/renter/hostdb
./modules/renter/hostdb/hosttree
./modules/renter/proto
./modules/renter/skynetblocklist
./modules/renter/skynetportals
package_pkgs: >-
./build
./cmd/sia-node-scanner
./cmd/siac
./cmd/siad
./cmd/skynet-benchmark
./compatibility
./crypto
./modules
./modules/consensus
./modules/explorer
./modules/feemanager
./modules/gateway
./modules/miner
./modules/wallet
./modules/transactionpool
./profile
./persist
./sync
./skykey
./types
siatest_pkgs: >-
./siatest
./siatest/consensus
./siatest/daemon
./siatest/feemanager
./siatest/gateway
./siatest/host
./siatest/miner
./siatest/transactionpool
./siatest/wallet
siatest_renter_pkgs: >-
./siatest/renter
siatest_renter_sub_pkgs: >-
./siatest/renter/contractor
./siatest/renter/hostdb
./siatest/renterhost
docker_hub_dev_hook: https://hub.docker.com/api/build/v1/source/57afb708-6926-411b-98fc-44c79f59097c/trigger/513a6d92-9f8b-4f04-b20a-ebd51b193b5d/call/
###############################################
# Define common stage parameters
###############################################
default: &default_params
## Run tests with most recent golang version to take advantage of any perf
## improvements.
image: nebulouslabs/sia-ci
before_script:
- date
- go version
- mkdir -p .cache/gocache
- export PATH=$PATH:$CI_PROJECT_DIR/.cache/bin/
- export GOPATH="$CI_PROJECT_DIR/.cache"
## Default common test params for regular and nightly pipelines
.default_test_common: &default_test_common_params
artifacts:
name: "SiaTesting-$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/SiaTesting
- $CI_PROJECT_DIR/cover/cover.out
when: always
after_script:
- cp -R /tmp/SiaTesting $CI_PROJECT_DIR/SiaTesting
## Default common test params for regular and nightly pipelines
## for Windows runner.
.default_test_common_windows: &default_test_common_windows_params
artifacts:
name: "SiaTesting-$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/SiaTesting
- $CI_PROJECT_DIR/cover/cover.out
when: always
after_script:
- XCOPY "C:\Windows\Temp\SiaTesting\*" "$CI_PROJECT_DIR\SiaTesting" /S /I /Y > $null
## Default params for Windows runner
.default_windows: &default_windows_params
before_script:
- $env:USERNAME
- New-Item -ItemType Directory -Force .cache\gocache
- $env:PATH += ";$CI_PROJECT_DIR\.cache\bin"
- $env:PATH
- $env:GOPATH = "$CI_PROJECT_DIR\.cache"
- $env:GOPATH
## Define the default test parameters.
.default_test: &default_test_params
## Merge the contents of aliases
<<: *default_params
<<: *default_test_common_params
stage: test
## disable default tests for scheduled pipelines (nightlies)
except:
- schedules
## Define the default test parameters
## for Windows runner.
.default_windows_test: &default_test_windows_params
## Merge the contents of aliases
<<: *default_windows_params
<<: *default_test_common_windows_params
stage: test
tags:
- nebulous-windows
## disable default tests for scheduled pipelines (nightlies)
except:
- schedules
## Define the default nightly test parameters.
.default_nightly_test: &default_nightly_params
## Merge the contents of aliases
<<: *default_test_params
<<: *default_test_common_params
## Only run during scheduled pipelines.
except:
- ""
only:
- schedules
## Define the default nightly test parameters
## for Windows runner.
.default_nightly_windows_test: &default_nightly_windows_params
## Merge the contents of aliases
<<: *default_test_windows_params
<<: *default_test_common_windows_params
## Only run during scheduled pipelines.
except:
- ""
only:
- schedules
###############################################
# Define specific stage parameters
###############################################
#################
# Lint Stage
#################
lint:
stage: lint
cache:
key: lint-cache
paths:
- .cache
script:
- export GOCACHE=$CI_PROJECT_DIR/.cache/gocache
- golangci-lint run -c .golangci.yml ./...
- make lint-analyze
- make markdown-spellcheck
- make test
#################
# Build Stage
#################
build:
stage: lint
## go 1.13 is the minimum accepted version for building Sia.
image: nebulouslabs/sia-ci
artifacts:
name: "Binaries"
paths:
- $CI_PROJECT_DIR/artifacts
script:
- ./check-builds.sh
#################
# Deploy Stage
#################
deploy:
stage: deploy
script:
- curl -X POST -H "Content-Type:application/json" --data '{"name":"'"$CI_COMMIT_REF_NAME"'"}' $docker_hub_dev_hook
only:
- master
############################
# Linux Tests
############################
#################
# Legacy Test
#################
legacy-tests:
<<: *default_test_params
cache:
key: legacy-cache
paths:
- .cache
script:
- make test-long run=. pkgs="$legacy_pkgs"
#################
# Package Tests
#################
package-host-tests:
<<: *default_test_params
cache:
key: package-cache
paths:
- .cache
script:
- make test-long run=. pkgs="$package_host_pkgs"
package-renter-tests:
<<: *default_test_params
cache:
key: package-cache
paths:
- .cache
script:
- make test-long run=. pkgs="$package_renter_pkgs"
package-tests:
<<: *default_test_params
cache:
key: package-cache
paths:
- .cache
script:
- make test-long run=. pkgs="$package_pkgs"
#################
# Siatest Tests
#################
siatest-tests:
<<: *default_test_params
cache:
key: siatest-cache
paths:
- .cache
script:
- make test-long run=. pkgs="$siatest_pkgs"
siatest-renter-tests:
<<: *default_test_params
cache:
key: siatest-renter-tests-cache
paths:
- .cache
script:
- apt-get update
- apt-get install -y fuse
- make test-long run=. pkgs="$siatest_renter_pkgs"
siatest-renter-sub-tests:
<<: *default_test_params
cache:
key: siatest-renter-sub-tests-cache
paths:
- .cache
script:
- apt-get update
- apt-get install -y fuse
- make test-long run=. pkgs="$siatest_renter_sub_pkgs"
############################
# Nightly Tests
############################
#################
# Legacy Test
#################
legacy-tests-nightly:
<<: *default_nightly_params
script:
- make test-vlong run=. pkgs="$legacy_pkgs"
# Windows execution
legacy-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$legacy_pkgs"
#################
# Package Test
#################
package-host-tests-nightly:
<<: *default_nightly_params
script:
- make test-vlong run=. pkgs="$package_host_pkgs"
# Windows execution
package-host-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$package_host_pkgs"
package-renter-tests-nightly:
<<: *default_nightly_params
script:
- make test-vlong run=. pkgs="$package_renter_pkgs"
# Windows execution
package-renter-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$package_renter_pkgs"
package-tests-nightly:
<<: *default_nightly_params
script:
- make test-vlong run=. pkgs="$package_pkgs"
# Windows execution
package-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$package_pkgs"
#################
# Siatest Test
#################
siatest-tests-nightly:
<<: *default_nightly_params
script:
- make test-vlong run=. pkgs="$siatest_pkgs"
# Windows execution
siatest-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$siatest_pkgs"
siatest-renter-tests-nightly:
<<: *default_nightly_params
script:
- apt-get update
- apt-get install -y fuse
- make test-vlong run=. pkgs="$siatest_renter_pkgs"
# Windows execution
siatest-renter-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$siatest_renter_pkgs"
siatest-renter-sub-tests-nightly:
<<: *default_nightly_params
script:
- apt-get update
- apt-get install -y fuse
- make test-vlong run=. pkgs="$siatest_renter_sub_pkgs"
# Windows execution
siatest-renter-sub-windows-tests-nightly:
<<: *default_nightly_windows_params
script:
- make test-vlong run=. pkgs="$siatest_renter_sub_pkgs"
############################
# Antfarm Tests
############################
# TODO:
# Enable antfarm test triger when the following permission issue is fixed:
# https://gitlab.com/gitlab-org/gitlab/-/issues/299433
# Updates to master and nightly schedule pipelines will trigger Sia Antfarm
# version tests
# antfarm-version-tests:
# stage: test
# trigger:
# project: NebulousLabs/Sia-Ant-Farm
# # strategy: depend
# variables:
# PARENT_CI_PIPELINE_SOURCE: $CI_PIPELINE_SOURCE
# only:
# - master