forked from paritytech/parity-bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
120 lines (114 loc) · 3.95 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
stages:
- test
- build
- publish
image: parity/rust:gitlab-ci
variables:
GIT_DEPTH: "3"
SIMPLECOV: "true"
RUST_BACKTRACE: "1"
RUSTFLAGS: " -C link-arg=-s"
CARGOFLAGS: ""
GIT_STRATEGY: pull
GIT_SUBMODULE_STRATEGY: recursive
CARGO_TARGET: x86_64-unknown-linux-gnu
cache:
key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME"
untracked: true
.test_tags: &test_tags #branches and tags for test stage
stage: test
tags:
- linux-docker
.no_git: &no_git # disable git strategy
variables:
GIT_STRATEGY: none
GIT_SUBMODULE_STRATEGY: none
.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries")
only: &releaseable_branches
- stable
- beta
- tags
- schedules
- master
.collect_artifacts: &collect_artifacts
artifacts:
name: "${CI_JOB_NAME}_${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
when: on_success
expire_in: 12 mos
paths:
- artifacts/
linux-stable-test:
<<: *test_tags
script:
- rustup default stable
- echo 'Building in release mode' && echo -en 'gitlab_fold:start:build.release'
- time cargo build --release && strip target/release/pbtc
- echo 'gitlab_fold:end:build.release'
- echo 'Running regtests from ./tools/regtests.sh' && echo -en 'gitlab_fold:start:regtests'
- time ./tools/regtests.sh
- echo -en 'gitlab_fold:end:regtests'
- echo 'Running bench from ./tools/bench.sh' && echo -en 'gitlab_fold:start:bench'
- time ./tools/bench.sh
- echo -en 'gitlab_fold:end:bench'
- echo 'Running tests' && echo -en 'gitlab_fold:start:tests'
- time cargo test --all
- echo -en 'gitlab_fold:end:tests'
linux-beta-test:
<<: *test_tags
script:
- rustup default beta
- echo 'Running check'
- time cargo check
- echo 'End check'
allow_failure: true
linux-nightly-test:
<<: *test_tags
script:
- rustup default nightly
- echo 'Running check'
- time cargo check
- echo 'End check'
allow_failure: true
build-linux:
stage: build
only: *releaseable_branches
script:
- git submodule update --init
- echo 'Building in release mode' && echo -en 'gitlab_fold:start:build.release'
- rustup default stable
- time cargo build --target $CARGO_TARGET -p pbtc --release
- md5sum target/$CARGO_TARGET/release/pbtc > pbtc.md5
- echo -en 'gitlab_fold:end:build.release'
- echo 'Running regtests from ./tools/regtests.sh' && echo -en 'gitlab_fold:start:regtests'
- ./tools/regtests.sh
- echo -en 'gitlab_fold:end:regtests'
- echo 'Running bench from ./tools/bench.sh' && echo -en 'gitlab_fold:start:bench'
- ./tools/bench.sh
- echo -en 'gitlab_fold:end:bench'
- sh tools/deb_build.sh amd64
- cp target/$CARGO_TARGET/release/pbtc deb/usr/bin/pbtc
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
- dpkg-deb -b deb "pbtc_"$VER"_amd64.deb"
- md5sum "pbtc_"$VER"_amd64.deb" > "pbtc_"$VER"_amd64.deb.md5"
- echo "_____ Post-processing binaries _____"
- rm -rf artifacts/*
- mkdir -p artifacts/$CARGO_TARGET
- cd artifacts/$CARGO_TARGET
- cp -v ../../target/$CARGO_TARGET/release/pbtc pbtc
- cp -v ../../pbtc_"$VER"_amd64.deb pbtc_"$VER"_amd64.deb
- cp -v ../../pbtc.md5 pbtc.md5
- cp -v ../../pbtc_"$VER"_amd64.deb.md5 pbtc_"$VER"_amd64.deb.md5
tags:
- linux-docker
<<: *collect_artifacts
publish-docker:
stage: publish
only: *releaseable_branches
<<: *no_git
cache: {}
dependencies:
- build-linux
script:
- tools/docker_build.sh
tags:
- shell