.gitlab-ci.yml 5.13 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
  - examples
Denis_P's avatar
Denis_P committed
11
12
13
14
15
16
17

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
18
  REGISTRY:                        registry.parity.io/parity/infrastructure/scripts
Hero Bird's avatar
Hero Bird committed
19
20
  ALL_CRATES:                      "core alloc utils lang2 lang2/macro cli"
  WASM_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
49
50
51
52
  retry:
    max: 2
    when: 
      - 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
#### stage:                        check-workspace
Denis_P's avatar
Denis_P committed
57

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

Hero Bird's avatar
Hero Bird committed
66
check-wasm:
Denis_P's avatar
Denis_P committed
67
  stage:                           check-workspace
Denis_P's avatar
Denis_P committed
68
69
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
70
71
72
    - 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
73

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

Hero Bird's avatar
Hero Bird committed
82
build-wasm:
Denis_P's avatar
Denis_P committed
83
84
85
  stage:                           check-workspace
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
86
87
88
    - 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
89

Hero Bird's avatar
Hero Bird committed
90
test-std:
Denis_P's avatar
Denis_P committed
91
92
93
  stage:                           check-workspace
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
94
95
96
    - for crate in ${ALL_CRATES}; do
        cargo test --verbose --all-features --release;
      done
Denis_P's avatar
Denis_P committed
97

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

Hero Bird's avatar
Hero Bird committed
106
clippy-wasm:
Denis_P's avatar
Denis_P committed
107
  stage:                           check-workspace
Denis_P's avatar
Denis_P committed
108
109
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
110
111
112
113
114
115
116
117
118
119
120
121
    - for crate in ${WASM_CRATES}; do
        cargo clippy --verbose --manifest-path ${crate}/Cargo.toml --no-default-features -- -D warnings;
      done

fmt:
  stage:                           check-workspace
  <<:                              *docker-env
  script:
    - for crate in ${ALL_CRATES}; do
        cargo fmt --verbose -- --check;
      done

Denis_P's avatar
Denis_P committed
122

Denis_P's avatar
Denis_P committed
123
#### stage:                        examples
Denis_P's avatar
Denis_P committed
124

Hero Bird's avatar
Hero Bird committed
125
examples-test:
Denis_P's avatar
Denis_P committed
126
  stage:                           examples
Denis_P's avatar
Denis_P committed
127
128
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
129
130
    - for DIR in examples/lang2/*; do 
        cargo test --verbose --manifest-path ${DIR}/Cargo.toml;
Denis_P's avatar
Denis_P committed
131
132
      done

Hero Bird's avatar
Hero Bird committed
133
examples-fmt:
Denis_P's avatar
Denis_P committed
134
  stage:                           examples
Denis_P's avatar
Denis_P committed
135
136
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
137
138
    - for example in examples/lang2/*; do 
        cargo fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
Denis_P's avatar
Denis_P committed
139
140
      done

Hero Bird's avatar
Hero Bird committed
141
examples-clippy-std:
Denis_P's avatar
Denis_P committed
142
  stage:                           examples
Denis_P's avatar
Denis_P committed
143
144
  <<:                              *docker-env
  script:
Hero Bird's avatar
Hero Bird committed
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
    - for example in examples/lang2/*; do 
        cargo clippy --verbose --manifest-path ${example}/Cargo.toml --all-features -- -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 -- -D warnings;
      done

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

examples-generate-abi:
  stage:                           examples
  <<:                              *docker-env
  script:
    - for example in examples/lang2/*; do 
        pushd $example &&
        cargo contract generate-abi &&
        popd;
Denis_P's avatar
Denis_P committed
175
      done