forked from rchain/rchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
178 lines (153 loc) · 5.06 KB
/
.drone.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
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
175
176
177
178
# Common parts
# FYI: There's no merging of arrays in YAML. At least not in the Go library
# Drone uses to parse YAML. So if you mix in &sbtenv and want to add
# additional volumes, as in docker-build step, you need to specify all volumes.
# See https://bors.tech/documentation/getting-started/ for why we have trying and staging here:
__branches: &branches
# Merges to `dev` are only ever done by bors, using a fast-forward merge, if the `staging` build passes.
# This means everything that lands in dev has already been tested in CI. Hence, the `dev` build is redundant.
# - dev
- master
- release-*
- testing*
- trying
- staging
__branch_build_condiditions: &branch_build_conditions
when:
event: [ push, tag ]
branch: *branches
__pr_build_condiditions: &pr_build_conditions
when:
event: [ pull_request ]
__buildenv: &buildenv
image: rchain/buildenv:latest
__sbtcompileenv: &sbtcompileenv
<<: *buildenv
environment:
- _JAVA_OPTIONS=-Xms2G -Xmx4G -Xss2m -XX:MaxMetaspaceSize=1G
-Dsbt.task.timings=true -Dsbt.task.timings.on.shutdown=true -Dsbt.task.timings.threshold=2000
volumes:
- /var/cache/rchain-build/.sbt:/root/.sbt
- /var/cache/rchain-build/.ivy2:/root/.ivy2
__sbttestenv: &sbttestenv
<<: *sbtcompileenv
environment:
- _JAVA_OPTIONS=-Xms2G -Xmx4G -XX:MaxMetaspaceSize=1G
-Dsbt.task.timings=true -Dsbt.task.timings.on.shutdown=true -Dsbt.task.timings.threshold=2000
# Build definition
clone:
git-clone:
image: rchain/buildenv:latest
commands: |
set -ex
git clone -b ${DRONE_TAG:-$DRONE_BRANCH} $DRONE_REMOTE_URL .
if [ x$DRONE_PULL_REQUEST != x ]; then
git fetch origin refs/pull/$DRONE_PULL_REQUEST/head
EMAIL=ci git merge --no-edit FETCH_HEAD
fi
git rev-parse HEAD
pipeline:
# since sbt starts compilation anew after copying/renaming the project, let's start all pr-* jobs at once
# let's also compile together with the (now smaller) unit tests
# pr build
pr-lint:
<<: *pr_build_conditions
group: parallel
<<: *sbttestenv
commands:
- cp -r . ../step.lint && cd ../step.lint
- sbt scalafmtCheckAll
pr-run-unit-tests:
<<: *pr_build_conditions
group: parallel
<<: *sbttestenv
commands:
- cp -r . ../step.run-unit-tests && cd ../step.run-unit-tests
- _JAVA_OPTIONS="$_JAVA_OPTIONS -Xss2m" sbt update rholang/bnfc:generate test:compile slowcooker:compile
- sbt "set test in casper := {}" test it:test
pr-run-casper-tests:
<<: *pr_build_conditions
group: parallel
<<: *sbttestenv
commands:
- cp -r . ../step.run-casper-tests && cd ../step.run-casper-tests
- sbt update rholang/bnfc:generate casper/test
# full build
compile:
<<: *branch_build_conditions
<<: *sbtcompileenv
commands:
- sbt update rholang/bnfc:generate test:compile slowcooker:compile
docker-build:
<<: *branch_build_conditions
<<: *sbtcompileenv
commands:
# Skip the `doc` task - it's being invoked explicitly later
- SKIP_DOC=true sbt node/docker:publishLocal
volumes:
- /var/cache/rchain-build/.sbt:/root/.sbt
- /var/cache/rchain-build/.ivy2:/root/.ivy2
- /var/run/docker.sock:/var/run/docker.sock
run-unit-tests:
<<: *branch_build_conditions
group: parallel
<<: *sbttestenv
commands:
- cp -r . ../step.run-unit-tests && cd ../step.run-unit-tests
- sbt "set test in casper := {}" test it:test
run-casper-tests:
<<: *branch_build_conditions
group: parallel
<<: *sbttestenv
commands:
- cp -r . ../step.run-casper-tests && cd ../step.run-casper-tests
- sbt casper/test
run-integration-tests:
<<: *branch_build_conditions
group: parallel
<<: *buildenv
environment:
- _JAVA_OPTIONS=-Xms2G -Xmx4G
commands:
- ./scripts/ci/run-integration-tests.sh
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp:/tmp
- /var/tmp/rchain-it:/var/tmp/rchain-it
package:
<<: *branch_build_conditions
group: parallel
<<: *sbtcompileenv
commands:
- cp -r . ../step.package && cd ../step.package
- mkdir -p artifacts
- sbt node/debian:packageBin node/universal:packageZipTarball
- cp node/target/rnode_*_all.deb node/target/universal/*.tgz artifacts/
- env JAVAC_VERSION=1.8 sbt clean compile doc node/rpm:packageBin
- cp node/target/rpm/RPMS/noarch/rnode-*.noarch.rpm artifacts/
# publish:
# <<: *branch_build_conditions
# <<: *buildenv
# commands:
# - cd ../step.package
# - ./scripts/ci/publish-artifacts
# secrets:
# - docker_username
# - docker_password
# - ssh_private_key
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
notify:
<<: *buildenv
commands:
- ./scripts/ci/send-email
secrets:
- email_host
- email_username
- email_password
- email_recipients
- email_sender
when:
event: [ push, tag ]
branch: [ master, release*, testing* ]
status: [ changed, failure ]