Skip to content

Commit e0078da

Browse files
authored
chore(ci): set up nightly barretenberg releases (#1761)
This PR pulls across the publishing workflow from Noir so that barretenberg can have nightly releases. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [x] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [x] Every change is related to the PR description. - [x] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist).
1 parent 0085e8b commit e0078da

File tree

2 files changed

+173
-140
lines changed

2 files changed

+173
-140
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Publish Barretenberg
2+
on:
3+
workflow_dispatch:
4+
# Allow pushing a manual nightly release
5+
inputs:
6+
tag:
7+
description: The tag to build from (leave empty to build a nightly release from master)
8+
required: false
9+
publish:
10+
description: Whether to publish the build artifacts
11+
type: boolean
12+
default: false
13+
schedule:
14+
# Run a nightly release at 2 AM UTC
15+
- cron: "0 2 * * *"
16+
17+
permissions:
18+
# Necessary to upload new release artifacts
19+
contents: write
20+
21+
jobs:
22+
build-linux:
23+
name: Build on Linux
24+
runs-on: ubuntu-20.04
25+
steps:
26+
- name: Checkout Code
27+
uses: actions/checkout@v3
28+
with:
29+
ref: ${{ inputs.tag || env.GITHUB_REF }}
30+
31+
- name: Install bleeding edge cmake
32+
run: |
33+
sudo apt -y remove --purge cmake
34+
sudo snap install cmake --classic
35+
36+
- name: Create Build Environment
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get -y install ninja-build yarn
40+
41+
- name: Install Clang16
42+
run: |
43+
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
44+
tar -xvf clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
45+
sudo cp clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/* /usr/local/bin/
46+
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/include/* /usr/local/include/
47+
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/* /usr/local/lib/
48+
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/share/* /usr/local/share/
49+
50+
- name: Install yarn
51+
run: |
52+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
53+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
54+
sudo apt -y update && sudo apt -y install yarn
55+
- name: Compile Barretenberg
56+
run: |
57+
cd cpp
58+
59+
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
60+
cmake --build --preset default --target bb
61+
62+
- name: Install WASI-SDK
63+
run: |
64+
cd cpp
65+
66+
./scripts/install-wasi-sdk.sh
67+
68+
- name: Compile Typescript
69+
run: |
70+
cd ts
71+
yarn install && yarn && yarn build
72+
73+
- name: Tar and GZip barretenberg.wasm
74+
run: tar -cvzf barretenberg.wasm.tar.gz cpp/build-wasm/bin/barretenberg.wasm
75+
76+
- name: Setup Node.js
77+
uses: actions/setup-node@v2
78+
with:
79+
node-version: "18"
80+
registry-url: "https://registry.npmjs.org"
81+
82+
- name: Deploy Typescript to NPM
83+
run: |
84+
cd ts
85+
yarn deploy
86+
env:
87+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
88+
89+
- name: Tar and GZip bb Binary (Ubuntu)
90+
run: tar -cvzf bb-ubuntu.tar.gz cpp/build/bin/bb
91+
92+
- name: Upload artifacts
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: release-linux-wasm
96+
path: |
97+
barretenberg.wasm.tar.gz
98+
bb-ubuntu.tar.gz
99+
100+
build-mac:
101+
name: Build on Mac
102+
runs-on: macos-13
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v3
106+
with:
107+
ref: ${{ inputs.tag || env.GITHUB_REF }}
108+
109+
# We need clang 14.0.3 or higher, as lower versions do not seem
110+
# to be spec conformant. In particular std::span does not seem
111+
# to follow the specifications.
112+
- name: Select Xcode version
113+
run: |
114+
sudo xcode-select -switch /Applications/Xcode_14.3.1.app
115+
116+
- name: Create Mac Build Environment
117+
run: |
118+
brew install cmake ninja
119+
120+
- name: Compile Barretenberg
121+
working-directory: cpp
122+
run: |
123+
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
124+
cmake --build --preset default --target bb
125+
126+
- name: Package barretenberg artifact
127+
working-directory: cpp/build/bin
128+
run: |
129+
mkdir dist
130+
cp ./bb ./dist/bb
131+
7z a -ttar -so -an ./dist/* | 7z a -si ./barretenberg-x86_64-apple-darwin.tar.gz
132+
133+
- name: Upload artifact
134+
uses: actions/upload-artifact@v3
135+
with:
136+
name: barretenberg-x86_64-apple-darwin
137+
path: ./cpp/build/bin/barretenberg-x86_64-apple-darwin.tar.gz
138+
retention-days: 3
139+
140+
release:
141+
name: Publish
142+
needs: [build-linux, build-mac]
143+
runs-on: ubuntu-latest
144+
steps:
145+
- name: Download files from Linux Runner
146+
uses: actions/download-artifact@v2
147+
with:
148+
name: release-linux-wasm
149+
150+
- name: Download files from Mac Runner
151+
uses: actions/download-artifact@v2
152+
with:
153+
name: barretenberg-x86_64-apple-darwin
154+
155+
- name: Publish to GitHub
156+
uses: softprops/action-gh-release@v1
157+
if: ${{ inputs.publish || github.event_name == 'schedule' }}
158+
with:
159+
tag_name: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch)
160+
prerelease: true
161+
files: |
162+
barretenberg.wasm.tar.gz
163+
bb-ubuntu.tar.gz
164+
barretenberg-x86_64-apple-darwin.tar.gz

circuits/cpp/barretenberg/.github/workflows/release-please.yml

+9-140
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ name: release-please
1212
jobs:
1313
release-please:
1414
name: Create Release
15-
outputs:
16-
tag-name: ${{ steps.release.outputs.tag_name }}
1715
runs-on: ubuntu-latest
1816
steps:
1917
- name: Run Release Please
@@ -22,144 +20,15 @@ jobs:
2220
with:
2321
command: manifest
2422

25-
build-linux:
26-
name: Build on Linux
27-
runs-on: ubuntu-20.04
28-
needs: [release-please]
29-
if: ${{ needs.release-please.outputs.tag-name }}
30-
steps:
31-
- name: Checkout Code
32-
uses: actions/checkout@v3
33-
34-
- name: Install bleeding edge cmake
35-
run: |
36-
sudo apt -y remove --purge cmake
37-
sudo snap install cmake --classic
38-
39-
- name: Create Build Environment
40-
run: |
41-
sudo apt-get update
42-
sudo apt-get -y install ninja-build yarn
43-
44-
- name: Install Clang16
45-
run: |
46-
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
47-
tar -xvf clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
48-
sudo cp clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/* /usr/local/bin/
49-
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/include/* /usr/local/include/
50-
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/* /usr/local/lib/
51-
sudo cp -r clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/share/* /usr/local/share/
52-
53-
- name: Install yarn
54-
run: |
55-
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
56-
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
57-
sudo apt -y update && sudo apt -y install yarn
58-
- name: Compile Barretenberg
59-
run: |
60-
cd cpp
61-
62-
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
63-
cmake --build --preset default --target bb
64-
65-
- name: Install WASI-SDK
66-
run: |
67-
cd cpp
68-
69-
./scripts/install-wasi-sdk.sh
70-
71-
- name: Compile Typescript
72-
run: |
73-
cd ts
74-
yarn install && yarn && yarn build
75-
76-
- name: Tar and GZip barretenberg.wasm
77-
run: tar -cvzf barretenberg.wasm.tar.gz cpp/build-wasm/bin/barretenberg.wasm
78-
79-
- name: Setup Node.js
80-
uses: actions/setup-node@v2
23+
- name: Dispatch to publish workflow
24+
uses: benc-uk/workflow-dispatch@v1
25+
if: ${{ steps.release.outputs.tag-name }}
8126
with:
82-
node-version: "18"
83-
registry-url: "https://registry.npmjs.org"
84-
85-
- name: Deploy Typescript to NPM
86-
run: |
87-
cd ts
88-
yarn deploy
89-
env:
90-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
27+
workflow: publish.yml
28+
repo: AztecProtocol/barretenberg
29+
ref: master
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
inputs: '{ "tag": "${{ steps.release.outputs.tag-name }}", "publish": true }'
9132

92-
- name: Tar and GZip bb Binary (Ubuntu)
93-
run: tar -cvzf bb-ubuntu.tar.gz cpp/build/bin/bb
9433

95-
- name: Upload artifacts
96-
uses: actions/upload-artifact@v2
97-
with:
98-
name: release-linux-wasm
99-
path: |
100-
barretenberg.wasm.tar.gz
101-
bb-ubuntu.tar.gz
102-
103-
build-mac:
104-
name: Build on Mac
105-
runs-on: macos-13
106-
needs: [release-please]
107-
if: ${{ needs.release-please.outputs.tag-name }}
108-
steps:
109-
- name: Checkout
110-
uses: actions/checkout@v3
111-
# We need clang 14.0.3 or higher, as lower versions do not seem
112-
# to be spec conformant. In particular std::span does not seem
113-
# to follow the specifications.
114-
- name: Select Xcode version
115-
run: |
116-
sudo xcode-select -switch /Applications/Xcode_14.3.1.app
117-
118-
- name: Create Mac Build Environment
119-
run: |
120-
brew install cmake ninja
121-
122-
- name: Compile Barretenberg
123-
working-directory: cpp
124-
run: |
125-
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
126-
cmake --build --preset default --target bb
127-
128-
- name: Package barretenberg artifact
129-
working-directory: cpp/build/bin
130-
run: |
131-
mkdir dist
132-
cp ./bb ./dist/bb
133-
7z a -ttar -so -an ./dist/* | 7z a -si ./barretenberg-x86_64-apple-darwin.tar.gz
134-
135-
- name: Upload artifact
136-
uses: actions/upload-artifact@v3
137-
with:
138-
name: barretenberg-x86_64-apple-darwin
139-
path: ./cpp/build/bin/barretenberg-x86_64-apple-darwin.tar.gz
140-
retention-days: 3
141-
142-
release:
143-
name: Publish
144-
needs: [build-linux, build-mac, release-please]
145-
runs-on: ubuntu-latest
146-
steps:
147-
- name: Download files from Linux Runner
148-
uses: actions/download-artifact@v2
149-
with:
150-
name: release-linux-wasm
151-
152-
- name: Download files from Mac Runner
153-
uses: actions/download-artifact@v2
154-
with:
155-
name: barretenberg-x86_64-apple-darwin
156-
157-
- name: Publish to GitHub
158-
uses: softprops/action-gh-release@v1
159-
with:
160-
tag_name: ${{ needs.release-please.outputs.tag-name }}
161-
prerelease: true
162-
files: |
163-
barretenberg.wasm.tar.gz
164-
bb-ubuntu.tar.gz
165-
barretenberg-x86_64-apple-darwin.tar.gz
34+

0 commit comments

Comments
 (0)