forked from althea-net/cosmos-gravity-bridge
-
Notifications
You must be signed in to change notification settings - Fork 2
247 lines (228 loc) · 9.4 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
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
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
# build the code before creating the release, GO and Solidity first for faster failures
- name: Build GO
run: |
cd module
make
- name: Set ENV var for GOPATH
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
- name: Build Solidity artifacts
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 Rust x86_64
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: true
# the 5 Rust binaries, a loop would make this much more compact
- name: Upload Rust client
id: upload-rust-release-client
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/client
asset_name: client
asset_content_type: application/bin
- name: Upload Rust Orchestrator
id: upload-rust-release-orchestrator
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/orchestrator
asset_name: orchestrator
asset_content_type: application/bin
- name: Upload Rust Relayer
id: upload-rust-release-relayer
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/relayer
asset_name: relayer
asset_content_type: application/bin
- name: Upload Rust register-delegate-keys
id: upload-rust-release-key-delegator
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/register-delegate-keys
asset_name: register-delegate-keys
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 Go Release Asset
id: upload-go-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.GOPATH }}/bin/gravity
asset_name: gravity
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.
- name: Build Rust ARM64
run: |
cd orchestrator
cross build --target aarch64-unknown-linux-musl --release --all
- name: Build GO ARM64
run: |
cd module
GOARCH=arm64 make
- name: Upload Rust client ARM
id: upload-rust-release-client-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/client
asset_name: client-arm
asset_content_type: application/bin
- name: Upload Rust Orchestrator ARM
id: upload-rust-release-orchestrator-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/orchestrator
asset_name: orchestrator-arm
asset_content_type: application/bin
- name: Upload Rust Relayer ARM
id: upload-rust-release-relayer-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/relayer
asset_name: relayer-arm
asset_content_type: application/bin
- name: Upload Rust register-delegate-keys ARM
id: upload-rust-release-key-delegator-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/register-delegate-keys
asset_name: register-delegate-keys-arm
asset_content_type: application/bin
- name: Upload Go Release Asset ARM
id: upload-go-release-asset-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.GOPATH }}/bin/gravity
asset_name: gravity-arm
asset_content_type: application/bin