.gitlab-ci.yml 5.68 KB
Newer Older
Denis_P's avatar
Denis_P committed
1
2
3
4
5
6
7
8
# .gitlab-ci.yml
#
# ink
#
# pipelines can be triggered manually in the web


stages:
Denis_P's avatar
Denis_P committed
9
10
  - check
  - workspace
Denis_P's avatar
Denis_P committed
11
  - examples
Denis_P's avatar
Denis_P committed
12
13
14

variables:
  GIT_STRATEGY:                    fetch
Denis_P's avatar
Denis_P committed
15
  GIT_DEPTH:                       "3"
Denis_P's avatar
Denis_P committed
16
17
18
  CARGO_HOME:                      "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
  CARGO_INCREMENTAL:               0
  CI_SERVER_NAME:                  "GitLab CI"
Denis_P's avatar
Denis_P committed
19
  REGISTRY:                        registry.parity.io/parity/infrastructure/scripts
20
  ALL_CRATES:                      "core alloc prelude utils lang2 lang2/macro"
Denis_P's avatar
Denis_P committed
21
22
23
24
25
26
27
28
29
30

.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
Denis_P's avatar
Denis_P committed
31
  image:                           ${REGISTRY}/ink-ci-linux:latest
Denis_P's avatar
Denis_P committed
32
  before_script:
Denis_P's avatar
Denis_P committed
33
34
    - cargo -vV
    - rustc -vV
Denis_P's avatar
Denis_P committed
35
    - rustup show
Denis_P's avatar
Denis_P committed
36
    - bash --version
Hero Bird's avatar
Hero Bird committed
37
    - mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config
Denis_P's avatar
Denis_P committed
38
39
    # 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
Denis_P's avatar
Denis_P committed
40
41
42
43
44
45
46
    - sccache -s
  only:
    - master
    - /^v[0-9]+\.[0-9]+.*$/        # i.e. v1.0, v2.1rc1
    - schedules
    - web
    - /^[0-9]+$/                   # PRs
Denis_P's avatar
Denis_P committed
47
48
  dependencies:                    []
  interruptible:                   true
49
50
  retry:
    max: 2
Denis_P's avatar
Denis_P committed
51
    when:
52
53
54
      - runner_system_failure
      - unknown_failure
      - api_failure
Denis_P's avatar
Denis_P committed
55
56
57
  tags:
    - linux-docker

Denis_P's avatar
Denis_P committed
58
59

#### stage:                        check
Denis_P's avatar
Denis_P committed
60

Hero Bird's avatar
Hero Bird committed
61
check-std:
Denis_P's avatar
Denis_P committed
62
  stage:                           check
Denis_P's avatar
Denis_P committed
63
64
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
65
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
66
        cargo check --verbose --all-features --manifest-path ${crate}/Cargo.toml;
Hero Bird's avatar
Hero Bird committed
67
      done
Denis_P's avatar
Denis_P committed
68

Hero Bird's avatar
Hero Bird committed
69
check-wasm:
Denis_P's avatar
Denis_P committed
70
  stage:                           check
Denis_P's avatar
Denis_P committed
71
72
  <<:                              *docker-env
  script:
73
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
74
75
        cargo check --verbose --no-default-features --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
      done
Denis_P's avatar
Denis_P committed
76

Denis_P's avatar
Denis_P committed
77

Denis_P's avatar
Denis_P committed
78
79
#### stage:                        workspace

Hero Bird's avatar
Hero Bird committed
80
build-std:
Denis_P's avatar
Denis_P committed
81
  stage:                           workspace
Denis_P's avatar
Denis_P committed
82
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
83
  needs:
Denis_P's avatar
Denis_P committed
84
    - check-std
Denis_P's avatar
Denis_P committed
85
  script:
Hero Bird's avatar
Hero Bird committed
86
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
87
        cargo build --verbose --all-features --release --manifest-path ${crate}/Cargo.toml;
Hero Bird's avatar
Hero Bird committed
88
      done
Denis_P's avatar
Denis_P committed
89

Hero Bird's avatar
Hero Bird committed
90
build-wasm:
Denis_P's avatar
Denis_P committed
91
  stage:                           workspace
Denis_P's avatar
Denis_P committed
92
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
93
  needs:
Denis_P's avatar
Denis_P committed
94
    - check-wasm
Denis_P's avatar
Denis_P committed
95
  script:
96
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
97
98
        cargo build --verbose --no-default-features --release --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
      done
Denis_P's avatar
Denis_P committed
99

Denis_P's avatar
Denis_P committed
100
101
test:
  stage:                           workspace
Denis_P's avatar
Denis_P committed
102
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
103
  needs:
Denis_P's avatar
Denis_P committed
104
    - check-std
Denis_P's avatar
Denis_P committed
105
  script:
Hero Bird's avatar
Hero Bird committed
106
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
107
        cargo test --verbose --all-features --release --manifest-path ${crate}/Cargo.toml;
Hero Bird's avatar
Hero Bird committed
108
      done
Denis_P's avatar
Denis_P committed
109

Hero Bird's avatar
Hero Bird committed
110
clippy-std:
Denis_P's avatar
Denis_P committed
111
  stage:                           workspace
Denis_P's avatar
Denis_P committed
112
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
113
  needs:
Denis_P's avatar
Denis_P committed
114
    - check-std
Denis_P's avatar
Denis_P committed
115
  script:
Hero Bird's avatar
Hero Bird committed
116
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
117
        cargo clippy --verbose --all-features --manifest-path ${crate}/Cargo.toml -- -D warnings;
Hero Bird's avatar
Hero Bird committed
118
      done
Denis_P's avatar
Denis_P committed
119

Hero Bird's avatar
Hero Bird committed
120
clippy-wasm:
Denis_P's avatar
Denis_P committed
121
  stage:                           workspace
Denis_P's avatar
Denis_P committed
122
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
123
  needs:
Denis_P's avatar
Denis_P committed
124
    - check-wasm
Denis_P's avatar
Denis_P committed
125
  script:
126
    - for crate in ${ALL_CRATES}; do
Hero Bird's avatar
Hero Bird committed
127
        cargo clippy --verbose --no-default-features --manifest-path ${crate}/Cargo.toml --target wasm32-unknown-unknown -- -D warnings;
Hero Bird's avatar
Hero Bird committed
128
129
130
      done

fmt:
Denis_P's avatar
Denis_P committed
131
  stage:                           workspace
Hero Bird's avatar
Hero Bird committed
132
133
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
134
    - cargo fmt --verbose --all -- --check
Hero Bird's avatar
Hero Bird committed
135

Denis_P's avatar
Denis_P committed
136

Denis_P's avatar
Denis_P committed
137
#### stage:                        examples
Denis_P's avatar
Denis_P committed
138

Denis_P's avatar
Denis_P committed
139
140
141
142
143
.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

Hero Bird's avatar
Hero Bird committed
144
examples-test:
Denis_P's avatar
Denis_P committed
145
  stage:                           examples
Denis_P's avatar
Denis_P committed
146
147
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
148
149
    - for example in examples/lang2/*; do
        cargo test --verbose --manifest-path ${example}/Cargo.toml;
Denis_P's avatar
Denis_P committed
150
151
      done

Hero Bird's avatar
Hero Bird committed
152
examples-fmt:
Denis_P's avatar
Denis_P committed
153
  stage:                           examples
Denis_P's avatar
Denis_P committed
154
155
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
156
    - for example in examples/lang2/*; do
Hero Bird's avatar
Hero Bird committed
157
        cargo fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
Denis_P's avatar
Denis_P committed
158
159
      done

Hero Bird's avatar
Hero Bird committed
160
examples-clippy-std:
Denis_P's avatar
Denis_P committed
161
  stage:                           examples
Denis_P's avatar
Denis_P committed
162
163
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
164
    - for example in examples/lang2/*; do
Hero Bird's avatar
Hero Bird committed
165
        cargo clippy --verbose --manifest-path ${example}/Cargo.toml -- -D warnings;
Hero Bird's avatar
Hero Bird committed
166
167
168
169
170
171
      done

examples-clippy-wasm:
  stage:                           examples
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
172
    - for example in examples/lang2/*; do
Hero Bird's avatar
Hero Bird committed
173
        cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
Hero Bird's avatar
Hero Bird committed
174
175
176
177
178
179
      done

examples-contract-build:
  stage:                           examples
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
180
    - *update-cargo-contract
Hero Bird's avatar
Hero Bird committed
181
182
183
184
185
186
    - for example in examples/lang2/*; do
        pushd $example &&
        cargo contract build &&
        popd;
      done

Denis_P's avatar
Denis_P committed
187
examples-generate-metadata:
Hero Bird's avatar
Hero Bird committed
188
189
190
  stage:                           examples
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
191
    - *update-cargo-contract
Denis_P's avatar
Denis_P committed
192
    - for example in examples/lang2/*; do
Hero Bird's avatar
Hero Bird committed
193
        pushd $example &&
Denis_P's avatar
Denis_P committed
194
        cargo contract generate-metadata &&
Hero Bird's avatar
Hero Bird committed
195
        popd;
Denis_P's avatar
Denis_P committed
196
      done