Skip to content

Commit 9c8ead7

Browse files
committed
ci: add compile and release workflow
1 parent 242c3b0 commit 9c8ead7

1 file changed

Lines changed: 148 additions & 0 deletions

File tree

.github/workflows/compile.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Compile and Release Compiled Guests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- master
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
compile:
21+
name: Compile ${{ matrix.guest }}-${{ matrix.zkvm }}
22+
runs-on: ubuntu-latest
23+
outputs:
24+
ere_tag: ${{ steps.get_ere_tag.outputs.ere_tag }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
guest:
29+
- block-encoding-length
30+
- empty
31+
- panic
32+
- stateless-validator-ethrex
33+
- stateless-validator-reth
34+
zkvm:
35+
- airbender
36+
- openvm
37+
- pico
38+
- risc0
39+
- sp1
40+
- zisk
41+
exclude:
42+
- guest: stateless-validator-ethrex
43+
zkvm: airbender
44+
- guest: stateless-validator-ethrex
45+
zkvm: openvm
46+
- guest: stateless-validator-ethrex
47+
zkvm: pico
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Install Rust toolchain
53+
uses: dtolnay/rust-toolchain@stable
54+
55+
- name: Get Ere tag
56+
id: get_ere_tag
57+
run: |
58+
ERE_TAG=$(cargo tree -p ere-platform-trait | head -n 1 | sed -E 's/ere-platform-trait v([0-9.]+) \(.*#([a-f0-9]{7}).*/\1-\2/')
59+
echo "ere_tag=${ERE_TAG}" >> $GITHUB_OUTPUT
60+
echo "Ere tag: ${ERE_TAG}"
61+
62+
- name: Pull compiler image
63+
run: |
64+
docker pull ghcr.io/eth-act/ere/ere-compiler-${{ matrix.zkvm }}:${{ steps.get_ere_tag.outputs.ere_tag }}
65+
66+
- name: Check for unused [patch] entries
67+
shell: bash
68+
run: |
69+
set -euo pipefail
70+
WARNING=$(cargo tree --manifest-path ./bin/${{ matrix.crate }}/${{ matrix.zkvm }}/Cargo.toml 2>&1 | grep -F "was not used in the crate graph" || true)
71+
if [ -n "$WARNING" ]; then
72+
echo "$WARNING"
73+
exit 1
74+
fi
75+
76+
- name: Compile guest
77+
run: |
78+
docker run \
79+
-v .:/ere-guests \
80+
-v ./output:/output \
81+
ghcr.io/eth-act/ere/ere-compiler-${{ matrix.zkvm }}:${{ steps.get_ere_tag.outputs.ere_tag }} \
82+
--compiler-kind rust-customized \
83+
--guest-path /ere-guests/bin/${{ matrix.crate }}/${{ matrix.zkvm }} \
84+
--output-path output/${{ matrix.guest }}-${{ matrix.zkvm }}
85+
86+
- name: Upload artifact
87+
if: github.event_name == 'push'
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: ${{ matrix.guest }}-${{ matrix.zkvm }}
91+
path: output/${{ matrix.guest }}-${{ matrix.zkvm }}
92+
if-no-files-found: error
93+
94+
create-release:
95+
name: Create release
96+
needs: compile-stateless-validator
97+
runs-on: ubuntu-latest
98+
if: github.ref_type == 'tag'
99+
steps:
100+
- name: Download all artifacts
101+
uses: actions/download-artifact@v4
102+
with:
103+
path: artifacts
104+
merge-multiple: true
105+
106+
- name: Display structure of downloaded files
107+
run: ls -R artifacts
108+
109+
- name: Generate release notes
110+
run: |
111+
echo "This release contains compiled guest programs for various zkVMs." > release-body.md
112+
echo "" >> release-body.md
113+
echo "Built with Ere compiler version: \`${{ needs.compile-stateless-validator.outputs.ere_tag }}\`." >> release-body.md
114+
echo "" >> release-body.md
115+
echo "## Compiled guest programs" >> release-body.md
116+
echo "" >> release-body.md
117+
118+
# Get unique guest names
119+
declare -A guests
120+
for file in artifacts/*; do
121+
if [ -f "$file" ]; then
122+
filename=$(basename "$file")
123+
guest=$(echo "$filename" | sed 's/-[^-]*$//')
124+
guests["$guest"]=1
125+
fi
126+
done
127+
128+
# Sort and group by guest
129+
for guest in $(echo "${!guests[@]}" | tr ' ' '\n' | sort); do
130+
echo "### $guest" >> release-body.md
131+
echo "" >> release-body.md
132+
for file in artifacts/$guest-*; do
133+
if [ -f "$file" ]; then
134+
filename=$(basename "$file")
135+
echo "- [\`$filename\`](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/$filename)" >> release-body.md
136+
fi
137+
done
138+
echo "" >> release-body.md
139+
done
140+
141+
- name: Release
142+
uses: softprops/action-gh-release@v2
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+
with:
146+
name: Compiled Guests (${{ github.ref_name }})
147+
files: artifacts/*
148+
body_path: release-body.md

0 commit comments

Comments
 (0)