.gitlab-ci.yml 5.25 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
20
  ALL_CRATES:                      "core alloc 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
47
48
  retry:
    max: 2
Denis_P's avatar
Denis_P committed
49
    when:
50
51
52
      - runner_system_failure
      - unknown_failure
      - api_failure
Denis_P's avatar
Denis_P committed
53
54
55
  tags:
    - linux-docker

Denis_P's avatar
Denis_P committed
56
57

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

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

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

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

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

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

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

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

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

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

Denis_P's avatar
Denis_P committed
135

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

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

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

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

examples-clippy-wasm:
  stage:                           examples
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
166
    - for example in examples/lang2/*; do
Hero Bird's avatar
Hero Bird committed
167
        cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
Hero Bird's avatar
Hero Bird committed
168
169
170
171
172
173
174
175
176
177
178
179
      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
180
examples-generate-metadata:
Hero Bird's avatar
Hero Bird committed
181
182
183
  stage:                           examples
  <<:                              *docker-env
  script:
Denis_P's avatar
Denis_P committed
184
    - for example in examples/lang2/*; do
Hero Bird's avatar
Hero Bird committed
185
        pushd $example &&
Denis_P's avatar
Denis_P committed
186
        cargo contract generate-metadata &&
Hero Bird's avatar
Hero Bird committed
187
        popd;
Denis_P's avatar
Denis_P committed
188
      done