Skip to content

Commit fac5fb5

Browse files
committed
fix: release bb-mac
1 parent 1a3c112 commit fac5fb5

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

.github/workflows/publish-bb-mac.yml

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Publish Barretenberg Mac
2+
3+
on:
4+
workflow_dispatch:
5+
# Allow pushing a manual nightly release
6+
inputs:
7+
ref_name:
8+
description: The ref name to build as. Useful for hotfixing a release.
9+
required: false
10+
tag:
11+
description: The tag to build from (leave empty to build a nightly release from master)
12+
required: false
13+
publish:
14+
description: Whether to publish the build artifacts
15+
type: boolean
16+
default: false
17+
schedule:
18+
# Run a nightly release at 2 AM UTC
19+
- cron: "0 2 * * *"
20+
21+
permissions:
22+
# Necessary to upload new release artifacts
23+
contents: write
24+
issues: write
25+
26+
jobs:
27+
build-mac-intel:
28+
name: Build on Mac (amd64-darwin)
29+
runs-on: macos-13
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
with:
34+
ref: ${{ inputs.tag || env.GITHUB_REF }}
35+
36+
- name: Create Mac Build Environment
37+
run: brew install cmake ninja llvm@16
38+
39+
- name: Replace version string in main.cpp
40+
working-directory: barretenberg/cpp
41+
run: |
42+
sed -i.bak "s/00000000\.00000000\.00000000/${{ inputs.ref_name || inputs.tag }}/g" main.cpp
43+
44+
- name: Compile Barretenberg
45+
working-directory: barretenberg/cpp
46+
run: |
47+
export PATH="/usr/local/opt/llvm@16/bin:$PATH"
48+
export LDFLAGS="-L/usr/local/opt/llvm@16/lib"
49+
export CPPFLAGS="-I/usr/local/opt/llvm@16/include"
50+
cmake -DCMAKE_BUILD_TYPE=RelWithAssert --preset default
51+
cmake --build --preset default --target bb
52+
53+
- name: Package barretenberg artifact (amd64-darwin)
54+
working-directory: barretenberg/cpp/build/bin
55+
run: |
56+
mkdir dist
57+
cp ./bb ./dist/bb
58+
7z a -ttar -so -an ./dist/* | 7z a -si ./barretenberg-amd64-darwin.tar.gz
59+
60+
- name: Upload artifact (amd64-darwin)
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: barretenberg-amd64-darwin
64+
path: ./barretenberg/cpp/build/bin/barretenberg-amd64-darwin.tar.gz
65+
retention-days: 3
66+
67+
build-mac-m1:
68+
name: Build on Mac (arm64-darwin)
69+
runs-on: macos-14
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v3
73+
with:
74+
ref: ${{ inputs.tag || env.GITHUB_REF }}
75+
76+
- name: Create Mac Build Environment
77+
run: brew install cmake ninja
78+
79+
- name: Replace version string in main.cpp
80+
working-directory: barretenberg/cpp
81+
run: |
82+
sed -i.bak "s/00000000\.00000000\.00000000/${{ inputs.ref_name || inputs.tag }}/g" main.cpp
83+
84+
- name: Compile Barretenberg
85+
working-directory: barretenberg/cpp
86+
run: |
87+
cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert
88+
cmake --build --preset default --target bb
89+
90+
- name: Package barretenberg artifact (arm64-darwin)
91+
working-directory: barretenberg/cpp/build/bin
92+
run: |
93+
mkdir dist
94+
cp ./bb ./dist/bb
95+
7z a -ttar -so -an ./dist/* | 7z a -si ./barretenberg-arm64-darwin.tar.gz
96+
97+
- name: Upload artifact (arm64-darwin)
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: barretenberg-arm64-darwin
101+
path: ./barretenberg/cpp/build/bin/barretenberg-arm64-darwin.tar.gz
102+
retention-days: 3
103+
104+
build-check:
105+
name: Check builds are successful
106+
needs: [build-mac-intel, build-mac-m1]
107+
if: ${{ always() }}
108+
runs-on: ubuntu-latest
109+
steps:
110+
- name: Report overall success
111+
env:
112+
FAIL: ${{ contains(needs.*.result, 'failure') }}
113+
run: |
114+
if [[ $FAIL == true ]]; then
115+
echo "At least one job failed, release is unsuccessful."
116+
exit 1
117+
else
118+
echo "All jobs succeeded, uploading artifacts to release."
119+
exit 0
120+
fi
121+
122+
- name: Checkout
123+
uses: actions/checkout@v3
124+
if: ${{ failure() }}
125+
with:
126+
ref: ${{ inputs.tag || env.GITHUB_REF }}
127+
128+
- name: Alert on build failure
129+
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5
130+
if: ${{ failure() }}
131+
env:
132+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
WORKFLOW_NAME: ${{ github.workflow }}
134+
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
135+
with:
136+
update_existing: true
137+
filename: .github/RELEASE_FAILED.md
138+
139+
release:
140+
name: Publish
141+
needs: [build-check]
142+
runs-on: ubuntu-latest
143+
steps:
144+
- name: Download artifact (amd64-darwin)
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: barretenberg-amd64-darwin
148+
149+
- name: Download artifact (arm64-darwin)
150+
uses: actions/download-artifact@v4
151+
with:
152+
name: barretenberg-arm64-darwin
153+
154+
- name: Publish to GitHub
155+
uses: softprops/action-gh-release@v1
156+
if: ${{ inputs.publish || github.event_name == 'schedule' }}
157+
with:
158+
tag_name: ${{ inputs.ref_name || inputs.tag || 'nightly' }}
159+
prerelease: true
160+
files: |
161+
barretenberg-amd64-darwin.tar.gz
162+
barretenberg-arm64-darwin.tar.gz

0 commit comments

Comments
 (0)