This repository has been archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path.drone.yml
210 lines (199 loc) · 7.7 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
kind: pipeline
name: default
steps:
- name: ganache
image: trufflesuite/ganache-cli:v6.4.3
detach: true
- name: core
image: enigmampc/enigma-core:0.0.10
privileged: true
depends_on: [clone]
commands:
- LD_LIBRARY_PATH=/opt/intel/libsgx-enclave-common/aesm /opt/intel/libsgx-enclave-common/aesm/aesm_service
- . /opt/sgxsdk/environment && . /root/.cargo/env
- cargo --version
- cd enigma-core && RUSTFLAGS=-Awarnings make DEBUG=1
- cd app && RUSTFLAGS=-Awarnings cargo test
volumes:
- name: isgx
path: /dev/isgx
- name: principal
image: enigmampc/enigma-core:0.0.10
privileged: true
depends_on: [clone]
commands:
- LD_LIBRARY_PATH=/opt/intel/libsgx-enclave-common/aesm /opt/intel/libsgx-enclave-common/aesm/aesm_service
- . /opt/sgxsdk/environment && . /root/.cargo/env
- cd enigma-principal && RUSTFLAGS=-Awarnings make DEBUG=1
- export NODE_URL="http://ganache:8545"
- cd app && RUSTFLAGS=-Awarnings cargo test
volumes:
- name: isgx
path: /dev/isgx
- name: tools_u
image: enigmampc/enigma-core:0.0.10
depends_on: [clone]
commands:
- . /root/.cargo/env
- export NODE_URL="http://ganache:8545"
- cd enigma-tools-u
- RUSTFLAGS=-Awarnings cargo test
- name: enigma_crypto
image: enigmampc/enigma-core:0.0.10
depends_on: [clone]
commands:
- LD_LIBRARY_PATH=/opt/intel/libsgx-enclave-common/aesm /opt/intel/libsgx-enclave-common/aesm/aesm_service
- . /opt/sgxsdk/environment && . /root/.cargo/env
- cd enigma-crypto
- RUSTFLAGS=-Awarnings cargo test
- RUSTFLAGS=-Awarnings cargo build --no-default-features --features=sgx
- name: tools_m
image: enigmampc/enigma-core:0.0.10
depends_on: [clone]
commands:
- LD_LIBRARY_PATH=/opt/intel/libsgx-enclave-common/aesm /opt/intel/libsgx-enclave-common/aesm/aesm_service
- . /opt/sgxsdk/environment && . /root/.cargo/env
- cd enigma-tools-m
- RUSTFLAGS=-Awarnings cargo test
- RUSTFLAGS=-Awarnings cargo check --no-default-features --features=sgx
- name: eng_wasm
image: enigmampc/enigma-core:0.0.10
depends_on: [clone]
commands:
- . /root/.cargo/env
- cd eng-wasm/derive
- cargo test
- name: enigma_types
image: enigmampc/enigma-core:0.0.10
depends_on: [clone]
commands:
- LD_LIBRARY_PATH=/opt/intel/libsgx-enclave-common/aesm /opt/intel/libsgx-enclave-common/aesm/aesm_service
- . /opt/sgxsdk/environment && . /root/.cargo/env
- cd enigma-types
- RUSTFLAGS=-Awarnings cargo test
- RUSTFLAGS=-Awarnings cargo check
- RUSTFLAGS=-Awarnings cargo check --features=std
- RUSTFLAGS=-Awarnings cargo check --features=sgx
- RUSTFLAGS=-Awarnings cargo check --features=alloc
- name: integration
image: enigmampc/docker-client
privileged: true
depends_on:
- core
- principal
volumes:
- name: sock
path: /var/run/docker.sock
commands:
- export MATCHING_BRANCH_P2P="$(git ls-remote --heads https://github.com/enigmampc/enigma-p2p.git ${DRONE_BRANCH} | wc -l)"
- export MATCHING_BRANCH_CONTRACT="$(git ls-remote --heads https://github.com/enigmampc/enigma-contract.git ${DRONE_BRANCH} | wc -l)"
- export MATCHING_BRANCH_DOCKER="$(git ls-remote --heads https://github.com/enigmampc/docker-environment.git ${DRONE_BRANCH} | wc -l)"
- export MATCHING_BRANCH_INTEGRATION="$(git ls-remote --heads https://github.com/enigmampc/integration-tests.git ${DRONE_BRANCH} | wc -l)"
- export DOCKER_TAG=core_${DRONE_BUILD_NUMBER}
- |
if [[ "$MATCHING_BRANCH_DOCKER" -eq 1 ]]; then
# which includes master and develop because these always exist
git clone --single-branch --branch ${DRONE_BRANCH} https://github.com/enigmampc/docker-environment.git
else
# otherwise we are on a feature branch, and we will build against develop
git clone --single-branch --branch develop https://github.com/enigmampc/docker-environment.git
fi
- cd docker-environment
- cp .env.template .env
- sed -i "s/COMPOSE_PROJECT_NAME=.*/COMPOSE_PROJECT_NAME=enigma_core_${DRONE_BUILD_NUMBER}/" .env
- sed -i "s/DOCKER_TAG=latest/DOCKER_TAG=${DOCKER_TAG}/" .env
- |
/bin/bash -c '
declare -a PROJECTS=(contract client)
declare -A DOCKER_IMAGES=([contract]=contract [client]=client)
declare -A PROJECT_BRANCH_FOUND=([contract]=$MATCHING_BRANCH_CONTRACT [client]=$MATCHING_BRANCH_INTEGRATION)
for project in $${PROJECTS[@]}; do
DOCKER_IMAGE="enigmampc/$${DOCKER_IMAGES[$project]}"
if [ "$${PROJECT_BRANCH_FOUND[$project]}" -eq 0 ]; then
docker pull "$DOCKER_IMAGE:develop"
docker tag "$DOCKER_IMAGE:develop" "$DOCKER_IMAGE:$DOCKER_TAG"
else
if [[ "$project" == "contract" ]]; then
make clone-contract BRANCH=${DRONE_BRANCH}
make build-contract DOCKER_TAG=$DOCKER_TAG
else
make clone-client-solo BRANCH=${DRONE_BRANCH}
make build-client DOCKER_TAG=$DOCKER_TAG
fi
fi
done'
- make clone-km BRANCH=${DRONE_BRANCH}
- make clone-core BRANCH=${DRONE_BRANCH}
- make build-core DOCKER_TAG=$DOCKER_TAG
- |
if [[ "$MATCHING_BRANCH_P2P" -eq 1 ]]; then
make clone-p2p BRANCH=${DRONE_BRANCH}
else
make clone-p2p BRANCH=develop
fi
- make build-km DOCKER_TAG=$DOCKER_TAG
- make build-worker DOCKER_TAG=$DOCKER_TAG
- export NODES=3
- SGX_MODE=HW docker-compose -f docker-compose.yml -f docker-compose.hw.yml up --scale worker=$NODES &
- sleep 240
- docker-compose exec -T client make test
- name: deploy
image: enigmampc/docker-client
privileged: true
depends_on:
- integration
when:
branch:
- develop
- master
environment:
USERNAME:
from_secret: username
PASSWORD:
from_secret: password
volumes:
- name: sock
path: /var/run/docker.sock
commands:
- cd docker-environment
- echo $PASSWORD | docker login -u $USERNAME --password-stdin
- if [[ ${DRONE_BRANCH} == "master" ]]; then export DOCKER_TAG=latest; else export DOCKER_TAG=develop; fi
- make clone-core BRANCH=${DRONE_BRANCH}
- make clone-p2p BRANCH=${DRONE_BRANCH}
- make clone-km BRANCH=${DRONE_BRANCH}
- make build-core SGX_MODE=SW DOCKER_TAG=$DOCKER_TAG
- make build-km SGX_MODE=SW DOCKER_TAG=$DOCKER_TAG
- make build-worker SGX_MODE=SW DOCKER_TAG=$DOCKER_TAG
- make build-core DOCKER_TAG=$DOCKER_TAG
- make build-km DOCKER_TAG=$DOCKER_TAG
- make build-worker DOCKER_TAG=$DOCKER_TAG
- docker push enigmampc/core-artifact-sw:$DOCKER_TAG
- docker push enigmampc/worker_sw:$DOCKER_TAG
- docker push enigmampc/key_management_sw:$DOCKER_TAG
- docker push enigmampc/core-artifact-hw:$DOCKER_TAG
- docker push enigmampc/worker_hw:$DOCKER_TAG
- docker push enigmampc/key_management_hw:$DOCKER_TAG
- name: cleanup
image: enigmampc/docker-client
privileged: true
volumes:
- name: sock
path: /var/run/docker.sock
depends_on:
- deploy
when:
status:
- success
- failure
commands:
- cd docker-environment
- export DOCKER_TAG=core_${DRONE_BUILD_NUMBER}
- docker-compose -f docker-compose.yml -f docker-compose.hw.yml down -v --rmi all --remove-orphans
- docker rmi -f enigmampc/core-artifact-hw:$DOCKER_TAG
volumes:
- name: isgx
host:
path: /dev/isgx
- name: sock
host:
path: /var/run/docker.sock