forked from althea-net/cosmos-gravity-bridge
-
Notifications
You must be signed in to change notification settings - Fork 10
293 lines (261 loc) · 10.3 KB
/
automated-release.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v**eth2"
name: Automated release build
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build and upload release assets
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go
- name: Checkout code
uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
with:
workspaces: orchestrator/
- name: Set ENV var for GOPATH
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
# build the code before creating the release, GO and Solidity first for faster failures
- name: Build Gravity Bridge Blockchain
run: |
cd module
make build-reproducible
- name: Build Gravity.sol
run: cd solidity && npm ci && npm run typechain
- name: Build contract deployment script into a static binary
run: cd solidity && npm ci && npm run compile-deployer
- name: Build Gravity Bridge tools
run: |
cargo install cross
cd orchestrator
cross build --target x86_64-unknown-linux-musl --release --all
# now that the code has built create the release and start uploading
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Gravity Bridge Tools
id: upload-gbt
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./orchestrator/target/x86_64-unknown-linux-musl/release/gbt
asset_name: gbt
asset_content_type: application/bin
- name: Upload Rust test runner
id: upload-rust-test-runner
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./orchestrator/target/x86_64-unknown-linux-musl/release/test-runner
asset_name: test-runner
asset_content_type: application/bin
- name: Upload Gravity Bridge Build Report
id: upload-gravity-bridge-build-report
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./module/artifacts/build_report
asset_name: build_report
asset_content_type: text
# the file names are hard to predict, so we rename them
- name: Rename build files
run: |
pushd ./module/artifacts/
cp *linux-amd64 gravity-linux-amd64
cp *darwin-amd64 gravity-darwin-amd64
cp *windows-amd64.exe gravity-windows-amd64.exe
cp *linux-arm64 gravity-linux-arm64
popd
- name: Upload Gravity Bridge Linux
id: upload-gravity-bridge-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./module/artifacts/gravity-linux-amd64
asset_name: gravity-linux-amd64
asset_content_type: application/bin
- name: Upload Gravity Bridge Mac
id: upload-gravity-bridge-mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./module/artifacts/gravity-darwin-amd64
asset_name: gravity-darwin-amd64
asset_content_type: application/bin
- name: Upload Gravity Bridge Windows
id: upload-gravity-bridge-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./module/artifacts/gravity-windows-amd64.exe
asset_name: gravity-windows-amd64.exe
asset_content_type: application/bin
- name: Upload Gravity Bridge Linux ARM
id: upload-gravity-bridge-linux-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./module/artifacts/gravity-linux-arm64
asset_name: gravity-linux-arm64
asset_content_type: application/bin
# next we upload the contract artifact, in a production situation a previous version will
# already be deployed on Ethereum and this won't be very useful, but as any chain leads up
# to launch it's nice to have a version history for the contract itself and see what if any
# changes are made that may go unnoticed due to tooling
- name: Upload Gravity Ethereum artifacts
id: upload-solidity-artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: solidity/artifacts/contracts/Gravity.sol/Gravity.json
asset_name: Gravity.json
asset_content_type: application/bin
- name: Upload Gravity Ethereum test artifact A
id: upload-solidity-test-a
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: solidity/artifacts/contracts/TestERC20A.sol/TestERC20A.json
asset_name: TestERC20A.json
asset_content_type: application/bin
- name: Upload Gravity Ethereum test artifact B
id: upload-solidity-test-b
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: solidity/artifacts/contracts/TestERC20B.sol/TestERC20B.json
asset_name: TestERC20B.json
asset_content_type: application/bin
- name: Upload Gravity Ethereum test artifact C
id: upload-solidity-test-c
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: solidity/artifacts/contracts/TestERC20C.sol/TestERC20C.json
asset_name: TestERC20C.json
asset_content_type: application/bin
- name: Upload contract deployer
id: upload-contract-deployer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: solidity/contract-deployer
asset_name: contract-deployer
asset_content_type: application/bin
# finally we start arm builds and uploads, we do this because the release
# entry is already made and rust builds take nearly 10 minutes, so instead
# of having a workable release in 20 minutes we can have one in 10 with the ARM
# binaries coming 10 minutes later.
# because of https://github.com/cross-rs/cross/issues/724
# we have to run `cargo clean` between targets
- name: Build GBT ARM64
run: |
cd orchestrator
cargo clean
cross build --target aarch64-unknown-linux-musl --release --all
- name: Upload Gravity Bridge Tools ARM
id: upload-gbt-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./orchestrator/target/aarch64-unknown-linux-musl/release/gbt
asset_name: gbt-arm
asset_content_type: application/bin
- name: Build GBT Windows
run: |
cd orchestrator
cargo clean
cross build --target x86_64-pc-windows-gnu --release --all
- name: Upload Gravity Bridge Tools Windows
id: upload-gbt-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./orchestrator/target/x86_64-pc-windows-gnu/release/gbt.exe
asset_name: gbt.exe
asset_content_type: application/bin
- name: Build GBT Mac
run: |
sudo apt install \
clang \
gcc \
g++ \
zlib1g-dev \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libssl-dev \
xz-utils \
libxml2-dev
rustup target add x86_64-apple-darwin
pushd /tmp/
git clone https://github.com/tpoechtrager/osxcross
cd osxcross
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
mv MacOSX10.10.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
popd
cd orchestrator
cargo clean
PATH="/tmp/osxcross/target/bin:$PATH" \
CC=o64-clang \
CXX=o64-clang++ \
LIBZ_SYS_STATIC=1 \
cargo build --target x86_64-apple-darwin --release
- name: Upload Gravity Bridge Tools Mac
id: upload-gbt-mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./orchestrator/target/x86_64-apple-darwin/release/gbt
asset_name: gbt-mac-amd64
asset_content_type: application/bin