forked from hicommonwealth/cargo-contract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
92 lines (80 loc) · 2.54 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
# .gitlab-ci.yml
#
# cargo-contract
#
# pipelines can be triggered manually in the web
stages:
- check
- test
- build
variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 3
CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
CI_SERVER_NAME: "GitLab CI"
REGISTRY: "paritytech"
RUSTUP_TOOLCHAIN: nightly
RUST_LIB_BACKTRACE: 0
.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}/contracts-ci-linux:latest
before_script:
- cargo -vV
- rustc -vV
- rustup show
- bash --version
- mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config
- mkdir -p ${CARGO_TARGET_DIR}
# 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
- git show
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
# be aware that the used image has cargo-contract installed
fmt:
stage: check
<<: *docker-env
script:
- cargo fmt --verbose --all -- --check
#### stage: test (all features)
test:
stage: test
<<: *docker-env
script:
- cargo test --verbose --all --all-features
#### stage: build (default features)
build:
stage: build
<<: *docker-env
<<: *collect-artifacts
only:
- schedules
- master
script:
- cargo build --verbose --release
after_script:
- mkdir -p ./artifacts/cargo-contract/
- cp ${CARGO_TARGET_DIR}/release/cargo-contract ./artifacts/cargo-contract/