-
Notifications
You must be signed in to change notification settings - Fork 36
416 lines (409 loc) · 14.7 KB
/
build.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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
name: Build and publish
on:
pull_request:
push:
branches:
- main
jobs:
native-build-linux-x86-64:
runs-on: ubuntu-22.04
env:
SKIP_GRADLE: true
steps:
- name: Prepare
run: |
# secp256k1 dependencies
sudo apt-get update
sudo apt upgrade -y
sudo apt-get install -y autoconf build-essential libtool automake patchelf
sudo apt autoremove -y
# golang dependencies
wget https://go.dev/dl/go1.22.4.linux-amd64.tar.gz
echo "ba79d4526102575196273416239cca418a651e049c2b099f3159db85e7bade7d go1.22.4.linux-amd64.tar.gz" | sha256sum -c || exit 1
tar -xzf go1.22.4.linux-amd64.tar.gz
export GOROOT=$(pwd)/go
export PATH=$GOROOT/bin:$PATH
# rust dependencies
export CARGO_HOME="$HOME/.cargo"
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.75.0
# nim dependencies
export CHOOSENIM_CHOOSE_VERSION=2.0.4
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y
export PATH=$HOME/.nimble/bin:$PATH
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: recursive
# Check whether gradle.properties version has been released already
# This prevents accidently publish same version
# Only check binary for arithmetic as all published together and arithmetic is the first
- name: Check release published
run: |
# Only interested in release version
if [[ $(grep -E 'version=[0-9]+\.[0-9]+\.[0-9]+$' gradle.properties | wc -l) -ne 0 ]]
then
# Extract version from gradle.properties
VERSION=$(grep "^version" gradle.properties | sed 's|^version=\(.*\)$|\1|g')
echo "Query for version [$VERSION]"
RESPONSE_CODE=$(curl --head -L --silent --output /dev/null --write-out %{http_code} "$ART_URL/$VERSION")
echo "Response code for curl command [$RESPONSE_CODE]"
if [[ $RESPONSE_CODE == "404" ]]
then
echo "Version [$VERSION] has not yet been published"
else
if [[ $RESPONSE_CODE == "200" ]]
then
echo "ERROR: Binary arithmetic already exists for version [$VERSION]"
echo "ERROR: Blocking republishing same version to the Besu Artifactory"
echo "url $ART_URL/$VERSION"
exit 1
else
echo "WARN: Unable to check whether version has been published previously"
echo "WARN: Failing job due to unknown status"
exit 1
fi
fi
else
echo "No validation as not a release version"
fi
env:
ART_URL: 'https://hyperledger.jfrog.io/artifactory/besu-maven/org/hyperledger/besu/arithmetic'
- name: Build
run: ./build.sh
- uses: actions/upload-artifact@v3.1.0
with:
name: arithmetic native build artifacts
path: arithmetic/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: blake2bf native build artifacts
path: blake2bf/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: bls12-381 native build artifacts
path: bls12-381/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256k1 native build artifacts
path: secp256k1/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256r1 native build artifacts
path: secp256r1/besu-native-ec/release/
- uses: actions/upload-artifact@v3.1.0
with:
name: ipa-multipoint native build artifacts
path: ipa-multipoint/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: gnark native build artifacts
path: gnark/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: constantine native build artifacts
path: constantine/build/
native-build-linux-arm64:
runs-on: besu-arm64
env:
SKIP_GRADLE: true
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
docker run -e SKIP_GRADLE=$SKIP_GRADLE -v $(pwd):/home/ubuntu ubuntu:20.04 /home/ubuntu/native-build.sh
- uses: actions/upload-artifact@v3.1.0
with:
name: arithmetic native build artifacts
path: arithmetic/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: blake2bf native build artifacts
path: blake2bf/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: bls12-381 native build artifacts
path: bls12-381/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256k1 native build artifacts
path: secp256k1/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256r1 native build artifacts
path: secp256r1/besu-native-ec/release/
- uses: actions/upload-artifact@v3.1.0
with:
name: ipa-multipoint native build artifacts
path: ipa-multipoint/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: gnark native build artifacts
path: gnark/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: constantine native build artifacts
path: constantine/build/
native-build-macos:
runs-on: macos-13
env:
SKIP_GRADLE: true
steps:
- name: Prepare
run: |
# secp256k1 dependencies
brew install autoconf automake libtool
# gnark dependencies
brew install go@1.22 || true
# rust dependencies
export CARGO_HOME="$HOME/.cargo"
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.75.0
# install both x86 and arm64 toolchains
export PATH="$HOME/.cargo/bin:$PATH"
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
# nim dependencies
export CHOOSENIM_CHOOSE_VERSION=2.0.4
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y
export PATH=$HOME/.nimble/bin:$PATH
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: ./build.sh
- uses: actions/upload-artifact@v3.1.0
with:
name: arithmetic native build artifacts
path: arithmetic/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: blake2bf native build artifacts
path: blake2bf/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: bls12-381 native build artifacts
path: bls12-381/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256k1 native build artifacts
path: secp256k1/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256r1 native build artifacts
path: secp256r1/besu-native-ec/release/
- uses: actions/upload-artifact@v3.1.0
with:
name: ipa-multipoint native build artifacts
path: ipa-multipoint/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: gnark native build artifacts
path: gnark/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: constantine native build artifacts
path: constantine/build/
native-build-m1:
runs-on: macos-13-xlarge
env:
SKIP_GRADLE: true
steps:
- name: Prepare
run: |
# check for homebrew and install from known sha if it is missing (like on macstadium)
if ! command -v brew &> /dev/null
then
# get pwd for homebrew:
export HOMEBREW_PREFIX=`pwd`/../homebrew
# use local homebrew 4.0.26 release, as brew is not available on macstadium:
mkdir -p $HOMEBREW_PREFIX && curl -L https://github.com/Homebrew/brew/tarball/eff45ef570f265e226f14ce91da72d7a6e7d516a| tar xz --strip 1 -C $HOMEBREW_PREFIX
export PATH=$HOMEBREW_PREFIX/bin:$PATH
echo "HOMEBREW_BIN=$HOMEBREW_PREFIX/bin" >> $GITHUB_ENV
fi
# secp256k1, gnark dependencies
brew install autoconf automake libtool
# gnark dependencies
brew install go@1.22 || true
# rust dependencies
export CARGO_HOME="$HOME/.cargo"
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.75.0
# install both x86 and arm64 toolchains
export PATH="$HOME/.cargo/bin:$PATH"
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
# nim dependencies
export CHOOSENIM_CHOOSE_VERSION=2.0.4
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y
export PATH=$HOME/.nimble/bin:$PATH
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 21
cache: gradle
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build
run: |
export HOMEBREW_BIN=${{ env.HOMEBREW_BIN }}
export PATH=$HOMEBREW_BIN:$PATH
./build.sh
- uses: actions/upload-artifact@v3.1.0
with:
name: arithmetic native build artifacts
path: arithmetic/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: blake2bf native build artifacts
path: blake2bf/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: bls12-381 native build artifacts
path: bls12-381/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256k1 native build artifacts
path: secp256k1/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: secp256r1 native build artifacts
path: secp256r1/besu-native-ec/release/
- uses: actions/upload-artifact@v3.1.0
with:
name: ipa-multipoint native build artifacts
path: ipa-multipoint/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: gnark native build artifacts
path: gnark/build/
- uses: actions/upload-artifact@v3.1.0
with:
name: constantine native build artifacts
path: constantine/build/
final-assembly:
runs-on: ubuntu-22.04
needs:
- native-build-macos
- native-build-m1
- native-build-linux-x86-64
- native-build-linux-arm64
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Download arithmetic
uses: actions/download-artifact@v3
with:
name: arithmetic native build artifacts
path: arithmetic/build/
- name: Download blake2bf
uses: actions/download-artifact@v3
with:
name: blake2bf native build artifacts
path: blake2bf/build/
- name: Download bls12-381
uses: actions/download-artifact@v3
with:
name: bls12-381 native build artifacts
path: bls12-381/build/
- name: Download secp256k1
uses: actions/download-artifact@v3
with:
name: secp256k1 native build artifacts
path: secp256k1/build/
- name: Download secp256r1
uses: actions/download-artifact@v3
with:
name: secp256r1 native build artifacts
path: secp256r1/besu-native-ec/release/
- name: Download ipa-multipoint
uses: actions/download-artifact@v3
with:
name: ipa-multipoint native build artifacts
path: ipa-multipoint/build/
- name: Download gnark
uses: actions/download-artifact@v3
with:
name: gnark native build artifacts
path: gnark/build/
- name: Download constantine into build path
uses: actions/download-artifact@v3
with:
name: constantine native build artifacts
path: constantine/build/resources/main
- name: Download constantine
uses: actions/download-artifact@v3
with:
name: constantine native build artifacts
path: constantine/build/
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 21
cache: gradle
- name: Dump environment
run: |
echo $OSTYPE: ${OSTYPE%%[0-9.]*}-`arch` && echo 'System.out.println(System.getProperty("os.name")+"-"+System.getProperty("os.arch") + "\n" + System.getProperty("java.library.path"));' |jshell -
- name: Dump info on constantine libs
run: |
find . -name 'libconstantine*' |xargs -r file
- name: gradle build
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: --no-daemon --parallel build --scan
- name: Dump info on constantine libs
run: |
find . -name 'libconstantine*' |xargs -r file
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: altbn128/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: arithmetic/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: blake2bf/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: bls12-381/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: secp256k1/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: secp256r1/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: ipa-multipoint/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: gnark/build/libs
- uses: actions/upload-artifact@v3.1.0
with:
name: jars
path: constantine/build/libs
- name: gradle publish
uses: gradle/gradle-build-action@v2
if: contains('refs/heads/release-', github.ref) || github.ref == 'refs/heads/main'
env:
ARTIFACTORY_USER: ${{ secrets.BESU_ARTIFACTORY_USER }}
ARTIFACTORY_KEY: ${{ secrets.BESU_ARTIFACTORY_TOKEN }}
with:
arguments: --no-daemon --parallel publish artifactoryPublish --scan