forked from rchain/rchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
149 lines (128 loc) · 3.87 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
# 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
__sbtenv: &sbtenv
<<: *buildenv
environment:
- _JAVA_OPTIONS=-Xms2G -Xmx4G -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
# 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:
# pr build
pr-compile:
<<: *pr_build_conditions
<<: *sbtenv
commands:
- sbt update rholang/bnfc:generate compile
pr-run-unit-tests:
<<: *pr_build_conditions
group: parallel
<<: *sbtenv
commands:
- sbt test it:test
# full build
compile:
<<: *branch_build_conditions
<<: *sbtenv
commands:
- sbt update rholang/bnfc:generate compile
docker-build:
<<: *branch_build_conditions
<<: *sbtenv
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
<<: *sbtenv
commands:
- cp -r . ../step.run-unit-tests && cd ../step.run-unit-tests
- sbt test it: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
<<: *sbtenv
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 ]