forked from use-ink/ink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
196 lines (170 loc) · 5.68 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
# .gitlab-ci.yml
#
# ink
#
# pipelines can be triggered manually in the web
stages:
- check
- workspace
- examples
variables:
GIT_STRATEGY: fetch
GIT_DEPTH: "3"
CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
CARGO_INCREMENTAL: 0
CI_SERVER_NAME: "GitLab CI"
REGISTRY: registry.parity.io/parity/infrastructure/scripts
ALL_CRATES: "core alloc prelude utils lang2 lang2/macro"
.collect-artifacts: &collect-artifacts
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 7 days
paths:
- artifacts/
.docker-env: &docker-env
image: ${REGISTRY}/ink-ci-linux:latest
before_script:
- cargo -vV
- rustc -vV
- rustup show
- bash --version
- mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config
# global RUSTFLAGS overrides the linker args so this way is better to pass the flags
- printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' | tee ${CARGO_HOME}/config
- sccache -s
only:
- master
- /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- schedules
- web
- /^[0-9]+$/ # PRs
dependencies: []
interruptible: true
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
tags:
- linux-docker
#### stage: check
check-std:
stage: check
<<: *docker-env
script:
- for crate in ${ALL_CRATES}; do
cargo check --verbose --all-features --manifest-path ${crate}/Cargo.toml;
done
check-wasm:
stage: check
<<: *docker-env
script:
- for crate in ${ALL_CRATES}; do
cargo check --verbose --no-default-features --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
done
#### stage: workspace
build-std:
stage: workspace
<<: *docker-env
needs:
- check-std
script:
- for crate in ${ALL_CRATES}; do
cargo build --verbose --all-features --release --manifest-path ${crate}/Cargo.toml;
done
build-wasm:
stage: workspace
<<: *docker-env
needs:
- check-wasm
script:
- for crate in ${ALL_CRATES}; do
cargo build --verbose --no-default-features --release --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
done
test:
stage: workspace
<<: *docker-env
needs:
- check-std
script:
- for crate in ${ALL_CRATES}; do
cargo test --verbose --all-features --release --manifest-path ${crate}/Cargo.toml;
done
clippy-std:
stage: workspace
<<: *docker-env
needs:
- check-std
script:
- for crate in ${ALL_CRATES}; do
cargo clippy --verbose --all-features --manifest-path ${crate}/Cargo.toml -- -D warnings;
done
clippy-wasm:
stage: workspace
<<: *docker-env
needs:
- check-wasm
script:
- for crate in ${ALL_CRATES}; do
cargo clippy --verbose --no-default-features --manifest-path ${crate}/Cargo.toml --target wasm32-unknown-unknown -- -D warnings;
done
fmt:
stage: workspace
<<: *docker-env
script:
- cargo fmt --verbose --all -- --check
#### stage: examples
.update-cargo-contract: &update-cargo-contract
# `cargo install` returns an error if there is nothing to update, so have to supress it here temporarily
- cargo install --git https://github.com/paritytech/cargo-contract || echo $?
- cargo contract -V
examples-test:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
cargo test --verbose --manifest-path ${example}/Cargo.toml;
done
examples-fmt:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
cargo fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
done
examples-clippy-std:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
cargo clippy --verbose --manifest-path ${example}/Cargo.toml -- -D warnings;
done
examples-clippy-wasm:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
done
examples-contract-build:
stage: examples
<<: *docker-env
script:
- *update-cargo-contract
- for example in examples/lang2/*; do
pushd $example &&
cargo contract build &&
popd;
done
examples-generate-metadata:
stage: examples
<<: *docker-env
script:
- *update-cargo-contract
- for example in examples/lang2/*; do
pushd $example &&
cargo contract generate-metadata &&
popd;
done