Skip to content

Commit ac0d1bb

Browse files
authored
ci(l2): add github workflow for releases (#2853)
**Motivation** <!-- Why does this pull request exist? What are its goals? --> We need an automated way to make releases for the L2. **Description** <!-- A clear and concise general description of the changes this PR introduces --> Added a new Github workflow that cross-compiles the L2 components and makes a new release with the binaries. To trigger the workflow, a tag with name `l2_vX.Y.Z` has to be created. A changelog will be auto-generated based on the last tag before this one. Binaries are compiled for linux (x86-64 & arm64) and macos (arm64) <!-- Link to issues: Resolves #111, Resolves #222 -->
1 parent 537d0f4 commit ac0d1bb

File tree

1 file changed

+254
-0
lines changed

1 file changed

+254
-0
lines changed

.github/workflows/tag_l2_release.yaml

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
name: L2 Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "l2_v*"
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
build-l2:
14+
strategy:
15+
matrix:
16+
platform:
17+
- ubuntu-latest
18+
- ubuntu-24.04-arm
19+
- macos-latest
20+
include:
21+
- platform: ubuntu-latest
22+
os: linux
23+
arch: x86-64
24+
- platform: ubuntu-24.04-arm
25+
os: linux
26+
arch: arm64
27+
- platform: macos-latest
28+
os: macos
29+
arch: arm64
30+
runs-on: ${{ matrix.platform }}
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Rustup toolchain install
36+
uses: dtolnay/rust-toolchain@stable
37+
38+
- name: Add Rust Cache
39+
uses: Swatinem/rust-cache@v2
40+
41+
- name: Build ethrex L2
42+
run: |
43+
cargo build --release --features l2 --bin ethrex
44+
mv target/release/ethrex ethrex-${{ matrix.os }}_${{ matrix.arch }}
45+
46+
- name: Upload artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: ethrex-${{ matrix.os }}_${{ matrix.arch }}
50+
path: ethrex-${{ matrix.os }}_${{ matrix.arch }}
51+
52+
build-prover-sp1:
53+
strategy:
54+
matrix:
55+
platform:
56+
- ubuntu-latest
57+
- ubuntu-24.04-arm
58+
- macos-latest
59+
backend:
60+
- sp1
61+
- exec
62+
include:
63+
- platform: ubuntu-latest
64+
os: linux
65+
arch: x86-64
66+
- platform: ubuntu-24.04-arm
67+
os: linux
68+
arch: arm64
69+
- platform: macos-latest
70+
os: macos
71+
arch: arm64
72+
- backend: sp1
73+
mode: sp1
74+
runs-on: ${{ matrix.platform }}
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Rustup toolchain install
80+
uses: dtolnay/rust-toolchain@stable
81+
with:
82+
toolchain: 1.82.0
83+
84+
- name: Install SP1
85+
env:
86+
SHELL: /bin/bash
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
run: |
89+
curl -L https://sp1up.succinct.xyz | bash
90+
~/.sp1/bin/sp1up --version 4.1.7
91+
92+
- name: Add Rust Cache
93+
uses: Swatinem/rust-cache@v2
94+
95+
- name: Build ethrex L2
96+
run: |
97+
cd crates/l2
98+
make build-prover PROVER=${{ matrix.mode }}
99+
cd ../../
100+
mv target/release/ethrex_prover ethrex_prover_${{ matrix.backend }}-${{ matrix.os }}_${{ matrix.arch }}
101+
102+
- name: Upload artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: ethrex_prover_${{ matrix.backend }}-${{ matrix.os }}_${{ matrix.arch }}
106+
path: ethrex_prover_${{ matrix.backend }}-${{ matrix.os }}_${{ matrix.arch }}
107+
108+
build-prover-risc0:
109+
if: false # Remove when fixed RISC0
110+
strategy:
111+
matrix:
112+
platform:
113+
- ubuntu-latest
114+
- macos-latest
115+
include:
116+
- platform: ubuntu-latest
117+
os: linux
118+
arch: x86-64
119+
- platform: macos-latest
120+
os: macos
121+
arch: arm64
122+
runs-on: ${{ matrix.platform }}
123+
steps:
124+
- name: Checkout code
125+
uses: actions/checkout@v4
126+
127+
- name: Rustup toolchain install
128+
uses: dtolnay/rust-toolchain@stable
129+
with:
130+
toolchain: 1.82.0
131+
132+
- name: Install RISC0
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
run: |
136+
curl -L https://risczero.com/install | bash
137+
~/.risc0/bin/rzup install
138+
~/.risc0/bin/rzup install cargo-risczero 1.2.0
139+
~/.risc0/bin/rzup default cargo-risczero 1.2.0
140+
141+
- name: Add Rust Cache
142+
uses: Swatinem/rust-cache@v2
143+
144+
- name: Build ethrex L2
145+
run: |
146+
cd crates/l2
147+
make build-prover PROVER=risc0
148+
cd ../../
149+
mv target/release/ethrex_prover ethrex_prover_risc0-${{ matrix.os }}_${{ matrix.arch }}
150+
151+
- name: Upload artifact
152+
uses: actions/upload-artifact@v4
153+
with:
154+
name: ethrex_prover_risc0-${{ matrix.os }}_${{ matrix.arch }}
155+
path: ethrex_prover_risc0-${{ matrix.os }}_${{ matrix.arch }}
156+
157+
build-prover-pico:
158+
if: false # Remove when fixed Pico
159+
strategy:
160+
matrix:
161+
platform:
162+
- ubuntu-latest
163+
- ubuntu-24.04-arm
164+
- macos-latest
165+
include:
166+
- platform: ubuntu-latest
167+
os: linux
168+
arch: x86-64
169+
- platform: ubuntu-24.04-arm
170+
os: linux
171+
arch: arm64
172+
- platform: macos-latest
173+
os: macos
174+
arch: arm64
175+
runs-on: ${{ matrix.platform }}
176+
steps:
177+
- name: Checkout code
178+
uses: actions/checkout@v4
179+
180+
- name: Rustup toolchain install
181+
uses: dtolnay/rust-toolchain@stable
182+
with:
183+
toolchain: nightly-2024-11-27
184+
185+
- name: Install Pico
186+
run: |
187+
rustup component add rust-src --toolchain nightly-2024-11-27
188+
cargo +nightly-2024-11-27 install --git https://github.com/brevis-network/pico pico-cli
189+
190+
- name: Add Rust Cache
191+
uses: Swatinem/rust-cache@v2
192+
193+
- name: Build ethrex L2
194+
run: |
195+
cd crates/l2
196+
make build-prover TOOLCHAIN=+nightly-2024-11-27 PROVER=pico
197+
cd ../../
198+
mv target/release/ethrex_prover ethrex_prover_pico-${{ matrix.os }}_${{ matrix.arch }}
199+
200+
- name: Upload artifact
201+
uses: actions/upload-artifact@v4
202+
with:
203+
name: ethrex_prover_pico-${{ matrix.os }}_${{ matrix.arch }}
204+
path: ethrex_prover_pico-${{ matrix.os }}_${{ matrix.arch }}
205+
206+
# Creates a draft release on GitHub with the binaries
207+
finalize-release:
208+
needs:
209+
- build-l2
210+
- build-prover-sp1
211+
# - build-prover-risc0 # Uncomment when fixed RISC0
212+
# - build-prover-pico # Uncomment when fixed Pico
213+
runs-on: ubuntu-latest
214+
steps:
215+
- name: Checkout Code
216+
uses: actions/checkout@v4
217+
with:
218+
fetch-depth: 0
219+
220+
- name: Download artifacts
221+
uses: actions/download-artifact@v4
222+
with:
223+
path: ./bin
224+
pattern: "ethrex*"
225+
226+
- name: Format name
227+
run: echo "RELEASE_NAME=$(echo ${{ github.ref_name }} | cut -d_ -f2)" >> $GITHUB_ENV
228+
229+
- name: Get previous tag
230+
run: |
231+
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
232+
echo "PREVIOUS_TAG: $name"
233+
echo "PREVIOUS_TAG=$name" >> $GITHUB_ENV
234+
235+
- name: Update CHANGELOG
236+
id: changelog
237+
uses: requarks/changelog-action@v1
238+
with:
239+
token: ${{ secrets.GITHUB_TOKEN }}
240+
fromTag: ${{ github.ref_name }}
241+
toTag: ${{ env.PREVIOUS_TAG }}
242+
writeToFile: false
243+
244+
- name: Finalize Release
245+
uses: softprops/action-gh-release@v2
246+
env:
247+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248+
with:
249+
files: ./bin/**/*
250+
draft: false
251+
prerelease: false
252+
tag_name: ${{ github.ref_name }}
253+
name: "L2: ${{ env.RELEASE_NAME }}"
254+
body: ${{ steps.changelog.outputs.changes }}

0 commit comments

Comments
 (0)