-
Notifications
You must be signed in to change notification settings - Fork 18
425 lines (371 loc) · 16.7 KB
/
build_and_release_binary.yaml
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
417
418
419
420
421
422
423
424
425
name: Build and release binaries
on:
pull_request:
push:
tags:
- "**"
jobs:
setup:
name: Setup
runs-on: [ubuntu-latest]
outputs:
release_version: ${{ steps.set.outputs.release_version }}
git_tag: ${{ steps.set.outputs.git_tag }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: Generate output with git tag
id: set
run: |
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
version=$(cut -d "-" -f1 <<< ${GITHUB_REF#refs/*/})
echo "release_version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "git_tag=${version}" >> $GITHUB_OUTPUT
else
echo "release_version=${{ github.base_ref }}" >> $GITHUB_OUTPUT
echo "git_tag=${{ github.base_ref }}" >> $GITHUB_OUTPUT
fi
build_linux_amd64:
runs-on: [matterlabs-ci-runner]
needs: [setup]
container:
image: matterlabs/llvm_runner:latest
credentials:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- name: Checkout source
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ steps.set.outputs.release_version }}
- name: Prepare environment
run: |
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf ssh://[email protected]/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf https://github.com/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf [email protected]:
- name: Building the Solidity compiler
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF
make -j$(nproc)
pwd
ls -la ./solc/
ls -la ./solc/solc
- name: Prepare binary file name
run: |
mkdir -p releases/linux-amd64
mv ./build/solc/solc releases/linux-amd64/solc-linux-amd64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
name: release_linux_amd64
path: releases
build_linux_arm64:
runs-on: [matterlabs-ci-runner-arm]
needs: [setup]
container:
image: matterlabs/llvm_runner:latest
credentials:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- name: Checkout source
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ steps.set.outputs.release_version }}
- name: Prepare environment
run: |
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf ssh://[email protected]/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf https://github.com/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf [email protected]:
- name: Building the Solidity compiler
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF -DUSE_CVC4=OFF
make -j$(nproc)
pwd
ls -la ./solc/
ls -la ./solc/solc
- name: Prepare binary file name
run: |
mkdir -p releases/linux-arm64
mv ./build/solc/solc releases/linux-arm64/solc-linux-arm64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
name: release_linux_arm64
path: releases
build_macos_amd64:
runs-on: macos-12-xl
needs: [setup]
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ steps.set.outputs.release_version }}
- name: Prepare environment
shell: zsh {0}
run: |
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf ssh://[email protected]/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf https://github.com/
# It is needed as we use some commands which a deprecated in newer versions of boost
- name: Install BOOST
shell: zsh {0}
run: |
curl -L -o boost_1_71_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz
tar xzf ./boost_1_71_0.tar.gz
cd ./boost_1_71_0
./bootstrap.sh --prefix=/usr/local --with-python-version=2.7
./b2 -j$(sysctl -n hw.ncpu)
./b2 install -j$(sysctl -n hw.ncpu)
- name: Warns not errs
run: |
sed -i '' -e '/option(PEDANTIC \"Enable extra warnings and pedantic build flags. Treat all warnings as errors.\" ON)/d' CMakeLists.txt
sed -i '' -e '/add_compile_options(-Werror)/d' ./cmake/EthCompilerSettings.cmake
sed -i '' -e '/add_compile_options(-pedantic)/d' ./cmake/EthCompilerSettings.cmake
- name: Cmake gen
shell: zsh {0}
env:
CXXFLAGS: "-Wno-narrowing"
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF
- name: Building the Solidity compiler
run: |
cd ./build
make -j12
./solc/solc --version
- name: Prepare binary file name
shell: zsh {0}
run: |
mkdir -p ./releases/macosx-amd64
mv ./build/solc/solc ./releases/macosx-amd64/solc-macosx-amd64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
name: release_macos_amd64
path: releases
build_macos_arm64:
runs-on: [self-hosted, macOS, ARM64]
needs: [setup]
steps:
- name: Clear repository
run: rm -rf ~/.gitconfig; rm -rf {*,.*} || true
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ steps.set.outputs.release_version }}
- name: Prepare environment
shell: zsh {0}
run: |
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf ssh://[email protected]/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf https://github.com/
# It is needed as we use some commands which a deprecated in newer versions of boost
- name: Install BOOST
shell: zsh {0}
run: |
curl -L -o boost_1_71_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz
tar xzf ./boost_1_71_0.tar.gz
cd ./boost_1_71_0
export BOOST_DIR=$(pwd)/boost
mkdir $BOOST_DIR
./bootstrap.sh --prefix=$BOOST_DIR
./b2 -j12
./b2 install -j12
- name: Warns not errs
run: |
sed -i '' -e '/option(PEDANTIC \"Enable extra warnings and pedantic build flags. Treat all warnings as errors.\" ON)/d' CMakeLists.txt
sed -i '' -e '/add_compile_options(-Werror)/d' ./cmake/EthCompilerSettings.cmake
sed -i '' -e '/add_compile_options(-pedantic)/d' ./cmake/EthCompilerSettings.cmake
- name: Cmake gen
shell: zsh {0}
env:
CXXFLAGS: "-Wno-narrowing"
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF
- name: Building the Solidity compiler
shell: zsh {0}
run: |
cd ./build
make -j12
./solc/solc --version
- name: Prepare binary file name
shell: zsh {0}
run: |
mkdir -p ./releases/macosx-arm64
mv ./build/solc/solc ./releases/macosx-arm64/solc-macosx-arm64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
name: release_macos_arm64
path: releases
build_windows_amd64:
runs-on: windows-2019-github-hosted-16core
needs: [setup]
outputs:
version_to_skip: ${{ steps.compare_version.outputs.result }}
steps:
# Had to install node to determine release version.
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install semver
run: npm install semver
- name: Check that version is >= 0.6.0
id: compare_version
uses: actions/github-script@v5
with:
script: |
const semver = require('semver');
const currentVersion = '${{ needs.setup.outputs.git_tag }}';
const result = semver.lt(currentVersion, '0.6.0');
console.log(`Is the version < 0.6.0? ${result}`);
return result;
result-encoding: string
- name: Checkout source
uses: actions/checkout@v3
if: steps.compare_version.outputs.result != 'true'
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ steps.set.outputs.release_version }}
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
if: steps.compare_version.outputs.result != 'true'
with:
version: "15.0.7"
- name: Prepare environment
if: steps.compare_version.outputs.result != 'true'
run: |
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf ssh://[email protected]/
git config --global --add url."https://${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}:[email protected]/".insteadOf https://github.com/
git config --global user.email "[email protected]"
git fetch --all
# try to apply win patch
git cherry-pick 860226e25dca397b5afd70680530963712aff050 || git cherry-pick --abort
# latest llvm for MSVC
git clone -q --depth=1 --branch=main https://github.com/zufuliu/llvm-utils.git c:\projects\llvm-utils
Invoke-Item "c:\projects\llvm-utils\VS2017\install.bat"
# Patch specific versions with include
$tag = git rev-parse --abbrev-ref HEAD
echo $tag
if ($tag -eq "0.8.5" -or $tag -eq "0.8.6" -or $tag -eq "0.8.7") {
sed -i '/^#pragma once/a #include <optional>' ./libevmasm/AssemblyItem.h
}
if ($tag -eq "0.8.7") {
sed -i '/^#pragma once/a #include <optional>' ./libyul/Object.h
}
if ($tag -eq "0.5.9" -or $tag -eq "0.5.10" -or $tag -eq "0.5.11") {
sed -i '/^#pragma once/a #include <memory>' ./libyul/backends/wasm/EWasmAST.h
}
clang --version
- name: Install windows Deps
if: steps.compare_version.outputs.result != 'true'
run: |
if ( -not (Test-Path "deps\boost") ) {
New-Item -ItemType Directory -Force -Path "deps"
Invoke-WebRequest -URI "https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-x86_64.zip" -OutFile cmake.zip
tar -xf cmake.zip
mv cmake-3.27.1-windows-x86_64 "deps\cmake"
# and serving it a page that requires JavaScript.
Invoke-WebRequest -URI "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.zip" -OutFile boost.zip
tar -xf boost.zip
cd boost_1_77_0
.\bootstrap.bat --with-toolset=clang
.\b2 -j4 -d0 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" link=static runtime-link=static variant=release threading=multi address-model=64 --prefix="..\deps\boost" --with-filesystem --with-system --with-program_options --with-test --with-regex --with-thread install
if ( -not $? ) { throw "Error building boost." }
cd ..
}
- name: Building the Solidity compiler
if: steps.compare_version.outputs.result != 'true'
run: |
$env:path += ";deps\cmake\bin\"
# remove warning-as-erro flag in cmake
sed -i '/option(PEDANTIC \"Enable extra warnings and pedantic build flags. Treat all warnings as errors.\" ON)/d' CMakeLists.txt
sed -i '/add_compile_options(-Werror)/d' ./cmake/EthCompilerSettings.cmake
sed -i '/add_compile_options(-pedantic)/d' ./cmake/EthCompilerSettings.cmake
sed -i '/add_compile_options(\\/WX)/d' ./cmake/EthCompilerSettings.cmake
sed -i '/elseif (DEFINED MSVC)/d' ./cmake/EthCompilerSettings.cmake
$env:CXXFLAGS="-Wno-narrowing -Qunused-arguments -Wno-everything -DBOOST_REGEX_NO_LIB -D_REGEX_MAX_STACK_COUNT=200000L -DJSON_USE_INT64_DOUBLE_CONVERSION -std=c++17 -stdlib=libc++"
mkdir build
cd build
$boost_dir=(Resolve-Path ..\deps\boost\lib\cmake\Boost-*)
cmake .. -D SOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -D USE_Z3="OFF" -DBoost_DIR="$boost_dir\" -DBoost_USE_STATIC_RUNTIME=1 -DBoost_USE_STATIC_LIBS=1 -DBoost_COMPILER=clang15 -T LLVM_v142 -DPEDANTIC=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build . -j 10 --target install --config Release
- name: Prepare binary file name
if: steps.compare_version.outputs.result != 'true'
run: |
mkdir -p releases\windows-amd64
ls .\build\solc\Release\
mv .\build\solc\Release\solc.exe releases\windows-amd64\solc-windows-amd64-${{ needs.setup.outputs.release_version }}.exe
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
if: steps.compare_version.outputs.result != 'true'
with:
name: release_windows_amd64
path: releases
prepare-release:
runs-on: [ matterlabs-default-infra-runners ]
if: startsWith(github.ref, 'refs/tags/')
needs:
- setup
- build_macos_arm64
- build_macos_amd64
- build_linux_arm64
- build_linux_amd64
- build_windows_amd64
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ steps.set.outputs.release_version }}
- name: Download artifact macos_arm64
uses: actions/download-artifact@v3
with:
name: release_macos_arm64
path: releases
- name: Download artifact macosx_amd64
uses: actions/download-artifact@v3
with:
name: release_macos_amd64
path: releases
- name: Download artifact linux_amd64
uses: actions/download-artifact@v3
with:
name: release_linux_amd64
path: releases
- name: Download artifact linux_arm64
uses: actions/download-artifact@v3
with:
name: release_linux_arm64
path: releases
- name: Download artifact release_windows_amd64
if: needs.build_windows_amd64.outputs.version_to_skip != 'true'
uses: actions/download-artifact@v3
with:
name: release_windows_amd64
path: releases
- name: Generate changelog
id: changelog
shell: bash
run: |
awk '/###/ {flag=!flag; if (seen++) exit; next} flag' ./Changelog.md > tmp_changelog.txt
- name: Prepare release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: false
name: zkVM solc ${{ needs.setup.outputs.release_version }}
body_path: ./tmp_changelog.txt
tag_name: ${{ needs.setup.outputs.release_version }}
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
files: |
releases/**/**