forked from AztecProtocol/aztec-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
277 lines (238 loc) · 9.19 KB
/
publish-bb.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
name: Publish Barretenberg
on:
workflow_dispatch:
# Allow pushing a manual nightly release
inputs:
tag:
description: The tag to build from (leave empty to build a nightly release from master)
required: false
publish:
description: Whether to publish the build artifacts
type: boolean
default: false
schedule:
# Run a nightly release at 2 AM UTC
- cron: "0 2 * * *"
permissions:
# Necessary to upload new release artifacts
contents: write
issues: write
jobs:
build-x86_64-linux-gnu:
name: Build on Linux GNU
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}
- name: Install bleeding edge cmake
run: |
sudo apt -y remove --purge cmake
sudo snap install cmake --classic
- name: Create Build Environment
run: |
sudo apt-get update
sudo apt-get -y install ninja-build
- name: Install Clang16
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
tar -xvf clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
sudo cp clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/* /usr/local/bin/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/include/* /usr/local/include/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/* /usr/local/lib/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/share/* /usr/local/share/
- name: Compile Barretenberg
run: |
cd barretenberg/cpp
cmake --preset default -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=RelWithAssert -DTARGET_ARCH=westmere
cmake --build --preset default --target bb
- name: Tar and GZip bb Binary (Ubuntu)
working-directory: barretenberg/cpp/build/bin
run: tar -cvzf barretenberg-x86_64-linux-gnu.tar.gz bb
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-linux
path: |
./barretenberg/cpp/build/bin/barretenberg-x86_64-linux-gnu.tar.gz
build-wasm-ts:
name: Build WASM and deploy to TS
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}
- name: Install bleeding edge cmake
run: |
sudo apt -y remove --purge cmake
sudo snap install cmake --classic
- name: Create Build Environment
run: |
sudo apt-get update
sudo apt-get -y install ninja-build yarn
- name: Install Clang16
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
tar -xvf clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
sudo cp clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/* /usr/local/bin/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/include/* /usr/local/include/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/* /usr/local/lib/
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/share/* /usr/local/share/
- name: Enable Corepack and Install Yarn v4.5.2 # Needed to call 'yarn build' on barretenberg/ts
run: |
corepack enable
corepack prepare [email protected] --activate
- name: Install WASI-SDK
run: |
cd barretenberg/cpp
./scripts/install-wasi-sdk.sh
- name: Compile Typescript # Compiles bb.js and wasms
run: |
cd barretenberg/ts
yarn install && yarn && yarn build
- name: Tar and GZip barretenberg.wasm
working-directory: barretenberg/cpp/build-wasm/bin
run: tar -cvzf barretenberg.wasm.tar.gz barretenberg.wasm
# - name: Setup Node.js
# uses: actions/setup-node@v2
# with:
# node-version: "18"
# registry-url: "https://registry.npmjs.org"
# - name: Deploy Typescript to NPM
# if: github.event.inputs.tag != 'nightly' && github.event.inputs.tag != '' # Do not deploy to npm if it is a nightly build
# run: |
# cd barretenberg/ts
# yarn deploy
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-wasm
path: |
./barretenberg/cpp/build-wasm/bin/barretenberg.wasm.tar.gz
build-mac-intel:
name: Build on Mac x86_64-apple-darwin
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}
- name: Create Mac Build Environment
run: brew install cmake ninja llvm@16
- name: Compile Barretenberg
working-directory: barretenberg/cpp
run: |
export PATH="/usr/local/opt/llvm@16/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm@16/lib"
export CPPFLAGS="-I/usr/local/opt/llvm@16/include"
cmake -DCMAKE_BUILD_TYPE=RelWithAssert --preset default
cmake --build --preset default --target bb
- name: Package barretenberg artifact
working-directory: barretenberg/cpp/build/bin
run: |
mkdir dist
cp ./bb ./dist/bb
7z a -ttar -so -an ./dist/* | 7z a -si ./barretenberg-x86_64-apple-darwin.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: barretenberg-x86_64-apple-darwin
path: ./barretenberg/cpp/build/bin/barretenberg-x86_64-apple-darwin.tar.gz
retention-days: 3
build-mac-m1:
name: Build on Mac aarch64-apple-darwin
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}
- name: Create Mac Build Environment
run: brew install cmake ninja
- name: Compile Barretenberg
working-directory: barretenberg/cpp
run: |
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
cmake --build --preset default --target bb
- name: Package barretenberg artifact
working-directory: barretenberg/cpp/build/bin
run: |
mkdir dist
cp ./bb ./dist/bb
7z a -ttar -so -an ./dist/* | 7z a -si ./barretenberg-aarch64-apple-darwin.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: barretenberg-aarch64-apple-darwin
path: ./barretenberg/cpp/build/bin/barretenberg-aarch64-apple-darwin.tar.gz
retention-days: 3
build-check:
name: Check builds are successful
needs:
[build-x86_64-linux-gnu, build-mac-intel, build-mac-m1, build-wasm-ts]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Report overall success
env:
FAIL: ${{ contains(needs.*.result, 'failure') }}
run: |
if [[ $FAIL == true ]]; then
echo "At least one job failed, release is unsuccessful."
exit 1
else
echo "All jobs succeeded, uploading artifacts to release."
exit 0
fi
- name: Checkout
uses: actions/checkout@v3
if: ${{ failure() }}
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}
# Raise an issue if the release failed
- name: Alert on dead links
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
if: ${{ failure() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
update_existing: true
filename: .github/RELEASE_FAILED.md
release:
name: Publish
needs: [build-check]
runs-on: ubuntu-latest
steps:
- name: Download files from Linux Runner
uses: actions/download-artifact@v4
with:
name: release-linux
- name: Download files for WASM
uses: actions/download-artifact@v4
with:
name: release-wasm
- name: Download files from x86_64 Mac Runner
uses: actions/download-artifact@v4
with:
name: barretenberg-x86_64-apple-darwin
- name: Download files from aarch64 Mac Runner
uses: actions/download-artifact@v4
with:
name: barretenberg-aarch64-apple-darwin
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
if: ${{ inputs.publish || github.event_name == 'schedule' }}
with:
tag_name: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch)
prerelease: true
files: |
barretenberg.wasm.tar.gz
barretenberg-x86_64-linux-gnu.tar.gz
barretenberg-x86_64-apple-darwin.tar.gz
barretenberg-aarch64-apple-darwin.tar.gz