forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
147 lines (133 loc) · 3.48 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
image: parity/rust:a811bb14-20190522
variables:
CI_SERVER_NAME: "GitLab CI"
CACHE_ROOT: "/tmp/cache/nearcore/${CI_JOB_NAME}"
CARGO_HOME: "/tmp/cache/nearcore/${CI_JOB_NAME}/cargo"
BUILD_TARGET: ubuntu
BUILD_ARCH: amd64
CARGO_TARGET: x86_64-unknown-linux-gnu
APT_CACHE_DIR: apt-cache
NEAR_PROTOS_DIR: ../core/protos/protos
.setup_rust: &setup_rust
rustup default nightly
.setup_cache: &setup_cache
mkdir -p "${CACHE_ROOT}/target" &&
ln -s "${CACHE_ROOT}/target" "${CI_PROJECT_DIR}/target"
.install_protos: &install_protos
sudo apt-get install -y unzip &&
curl -Lo /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip &&
sudo unzip /tmp/protoc.zip -d protoc &&
sudo mv protoc/bin/* /usr/local/bin/ &&
sudo chmod 755 /usr/local/bin/protoc
.setup_python: &setup_python
sudo apt-get install -y python-dev
.cleanup_obsolete_cache: &cleanup_obsolete_cache
find "${CACHE_ROOT}/target" -atime +60 -delete
.code_coverage: &code_coverage
mkdir -pv $APT_CACHE_DIR && apt-get -qq update &&
apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc &&
./scripts/coverage.sh
stages:
- rust
- libs
cache:
paths:
- apt-cache
# Test all but expensive integration tests.
test_cargo:
stage: rust
tags:
- gcloud
before_script:
- *setup_rust
#- rustup component add clippy
- *setup_cache
- *install_protos
script:
- rustc --version && cargo --version
# - ./scripts/run_clippy.sh
# - ./scripts/build_wasm.sh
- cargo check --all --tests --benches
- cargo test --all --verbose
after_script:
- *cleanup_obsolete_cache
# Regression tests.
test_regression:
stage: rust
before_script:
- *setup_rust
- *setup_cache
- *install_protos
script:
- rustc --version && cargo --version
- ./scripts/build_wasm.sh
- cargo test --package nearcore --test test_tps_regression test --features regression_tests
tags:
- regression_tests
after_script:
- *cleanup_obsolete_cache
only:
- schedules
# A set of expensive tests.
test_cases_testnet_rpc:
stage: rust
before_script:
- *setup_rust
- *setup_cache
- *install_protos
script:
- rustc --version && cargo --version
- ./scripts/build_wasm.sh
- cargo test --package nearcore --test test_cases_testnet_rpc test --features expensive_tests
tags:
- expensive_tests
after_script:
- *cleanup_obsolete_cache
only:
- schedules
release_build:
stage: rust
tags:
- gcloud
before_script:
- *setup_rust
- *setup_cache
- *install_protos
script:
- rustc --version && cargo --version
after_script:
- *cleanup_obsolete_cache
#
#coverage:
# stage: libs
# before_script:
# - *setup_rust
# - *setup_cache
# - *install_protos
# script:
# - ./scripts/build_wasm.sh
# - cargo test --all --no-run
# - *code_coverage
#
test_nearlib:
stage: libs
tags:
- gcloud
before_script:
- *setup_rust
- *setup_cache
- *install_protos
dependencies:
- release_build
script:
- ./scripts/test_nearlib.sh
#test_pynear:
# stage: libs
# before_script:
# - *install_protos
# - *setup_python
# dependencies:
# - release_build
# script:
# - export NEAR_DEVNET_EXE=../devnet
# - cd pynear && python setup.py test