.gitlab-ci.yml 5.33 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
15
16
17
18

variables:
  GIT_STRATEGY:                    fetch
  CARGO_HOME:                      "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
  SCCACHE_DIR:                     "/ci-cache/${CI_PROJECT_NAME}/sccache"
  CARGO_INCREMENTAL:               0
  CI_SERVER_NAME:                  "GitLab CI"
Denis_P's avatar
Denis_P committed
19
  REGISTRY:                        registry.parity.io/parity/infrastructure/scripts
Hero Bird's avatar
Hero Bird committed
20
21
  ALL_CRATES:                      "core alloc utils lang2 lang2/macro cli"
  WASM_CRATES:                     "core alloc utils lang2 lang2/macro"
Denis_P's avatar
Denis_P committed
22
23
24
25
26
27
28
29
30
31

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

Denis_P's avatar
Denis_P committed
57
58

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

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

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

Denis_P's avatar
Denis_P committed
76
77
#### stage:                        workspace

Hero Bird's avatar
Hero Bird committed
78
build-std:
Denis_P's avatar
Denis_P committed
79
  stage:                           workspace
Denis_P's avatar
Denis_P committed
80
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
81
82
  dependencies:
    - check-std
Denis_P's avatar
Denis_P committed
83
  script:
Hero Bird's avatar
Hero Bird committed
84
85
86
    - for crate in ${ALL_CRATES}; do
        cargo build --verbose --all-features --release;
      done
Denis_P's avatar
Denis_P committed
87

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

Denis_P's avatar
Denis_P committed
98
99
test:
  stage:                           workspace
Denis_P's avatar
Denis_P committed
100
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
101
102
  dependencies:
    - check-std
Denis_P's avatar
Denis_P committed
103
  script:
Hero Bird's avatar
Hero Bird committed
104
105
106
    - for crate in ${ALL_CRATES}; do
        cargo test --verbose --all-features --release;
      done
Denis_P's avatar
Denis_P committed
107

Hero Bird's avatar
Hero Bird committed
108
clippy-std:
Denis_P's avatar
Denis_P committed
109
  stage:                           workspace
Denis_P's avatar
Denis_P committed
110
  <<:                              *docker-env
Denis_P's avatar
Denis_P committed
111
112
  dependencies:
    - check-std
Denis_P's avatar
Denis_P committed
113
  script:
Hero Bird's avatar
Hero Bird committed
114
115
116
    - for crate in ${ALL_CRATES}; do
        cargo clippy --verbose --all-features -- -D warnings;
      done
Denis_P's avatar
Denis_P committed
117

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

fmt:
Denis_P's avatar
Denis_P committed
129
  stage:                           workspace
Hero Bird's avatar
Hero Bird committed
130
131
132
133
134
135
  <<:                              *docker-env
  script:
    - for crate in ${ALL_CRATES}; do
        cargo fmt --verbose -- --check;
      done

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

Hero Bird's avatar
Hero Bird committed
139
examples-test:
Denis_P's avatar
Denis_P committed
140
  stage:                           examples
Denis_P's avatar
Denis_P committed
141
142
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
143
144
    - for example in examples/lang2/*; do
        cargo test --verbose --manifest-path ${example}/Cargo.toml;
Denis_P's avatar
Denis_P committed
145
146
      done

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

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

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

examples-contract-build:
  stage:                           examples
  <<:                              *docker-env
  script:
    - for example in examples/lang2/*; do
        pushd $example &&
        cargo contract build &&
        popd;
      done

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