forked from paritytech/parity-scale-codec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
201 lines (175 loc) · 5.26 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
# .gitlab-ci.yml
#
include:
- project: parity/infrastructure/ci_cd/shared
ref: main
file: /common/ci-unified.yml
stages:
- check
- test
- build
- publish
variables:
GIT_STRATEGY: fetch
GIT_DEPTH: "100"
CARGO_INCREMENTAL: 0
CI_IMAGE: !reference [.ci-unified, variables, CI_IMAGE]
default:
cache: {}
interruptible: true
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
.kubernetes-env:
image: $CI_IMAGE
tags:
- kubernetes-parity-build
.docker-env:
image: $CI_IMAGE
before_script:
- cargo -vV
- rustc -vV
- rustup show
- bash --version
rules:
- if: $CI_PIPELINE_SOURCE == "trigger"
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "tags"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
tags:
- linux-docker
#### stage: check
check-clippy:
stage: check
extends: .docker-env
script:
- rustup component add clippy --toolchain stable-x86_64-unknown-linux-gnu
- time cargo +stable clippy --locked -- -Dwarnings
- time cargo +stable clippy --locked -p parity-scale-codec-derive -- -Dwarnings
- time cargo +stable clippy --locked --test clippy -- -Dwarnings
check-rust-stable-no_derive_no_std:
stage: check
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable check --verbose --no-default-features --features bit-vec,bytes,generic-array
check-rust-stable-no_std-chain-error:
stage: check
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable check --verbose --no-default-features --features chain-error
check-rust-stable-no_derive:
stage: check
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable check --verbose --features bit-vec,bytes,generic-array
check-rust-stable-only_mel:
stage: check
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable check --verbose --features max-encoded-len
#### stage: test
test-rust-stable:
stage: test
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len
test-rust-stable-no_derive:
stage: test
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable test --verbose --features bit-vec,bytes,generic-array
test-rust-stable-only_mel:
stage: test
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable test --verbose --features max-encoded-len
test-rust-stable-only_mel-no_default_std:
stage: test
extends: .docker-env
variables:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo +stable test --verbose --features max-encoded-len,std --no-default-features
bench-rust-nightly:
stage: test
extends: .docker-env
script:
- time cargo +nightly bench --features bit-vec,bytes,generic-array,derive
miri:
stage: test
extends: .docker-env
variables:
RUST_BACKTRACE: 1
MIRIFLAGS: "-Zmiri-disable-isolation"
script:
- time cargo +nightly miri test --features bit-vec,bytes,generic-array,arbitrary --release
# check that build is no_std compatible
# more info: https://github.com/paritytech/parity-scale-codec/pull/389
build-no-std:
stage: test
extends: .docker-env
variables:
RUST_BACKTRACE: 1
script:
# this target doesn't support std envs; it should flag any unexpected uses of std
- rustup target add thumbv6m-none-eabi
- time cargo build --target thumbv6m-none-eabi --no-default-features
build-no-atomic-ptrs:
stage: test
extends: .docker-env
variables:
RUST_BACKTRACE: 1
script:
# this target doesn't have atomic ptrs. Some parts of alloc are not available there
# we want to make sure that this crate still works on those targets
- cargo +nightly check --target bpfel-unknown-none -Zbuild-std="core,alloc" --no-default-features --features generic-array,derive,max-encoded-len,chain-error
#### stage: build
build-linux-ubuntu-amd64:
stage: build
extends: .docker-env
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "tags"
script:
- cargo build --verbose --release --features bit-vec,bytes,generic-array,derive
#### stage: publish
publish-dry-run:
stage: publish
extends: .kubernetes-env
# artificial dependency in order not to wait miri job
needs:
- job: check-clippy
artifacts: false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
script:
- cargo publish -p parity-scale-codec --dry-run
publish-crate:
stage: publish
extends: .kubernetes-env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v.[0-9]+\.[0-9]+.*$/ # i.e. v.1.0, v.2.1rc1
script:
- cargo publish -p parity-scale-codec