-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (147 loc) · 5.16 KB
/
artifacts.yaml
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
name: build-artifacts
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches: [ "main" ]
jobs:
check-version:
name: Check package.json version update
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Fetch main branch
run: |
git fetch origin main
- name: Compare package.json version with main
id: version_check
run: |
PR_VERSION=$(jq -r .version package.json)
MAIN_VERSION=$(git show origin/main:package.json | jq -r .version)
echo "PR version: $PR_VERSION"
echo "Main version: $MAIN_VERSION"
if [ "$PR_VERSION" == "$MAIN_VERSION" ]; then
echo "Error: package.json version has not been updated in this PR."
exit 1
else
echo "package.json version has been updated in this PR."
fi
build:
runs-on: ubuntu-latest
needs: check-version
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Protocol Buffers
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libprotobuf-dev
- name: Configure Git for Private Repos
run: |
git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-10-28
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install Circom
run: |
CIRCOM_VERSION=2.1.9
curl -L https://github.com/iden3/circom/releases/download/v$CIRCOM_VERSION/circom-linux-amd64 -o circom
chmod +x circom
sudo mv circom /usr/local/bin/
circom --version
- name: Install Node.js dependencies
run: |
npm ci
- name: Get package version
id: package_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup circom-witnesscalc
run: |
cd .. && git clone https://github.com/pluto/circom-witnesscalc.git
cd circom-witnesscalc
cargo install --path .
echo $(which build-circuit)
- name: Build circuits using Makefile
run: |
make debug # Show what will be processed
make build # Build the circuits
- name: Build and run parameter generator
run: |
rustup install nightly
# Build the parameter generator
cargo build --release
# Generate parameters using makefile target
make params
# Verify parameter files were created
for target_dir in builds/target_*b; do
size=$(basename "$target_dir" | sed 's/target_//')
# Calculate ROM length the same way as in Makefile
rom_length=$(echo "${size%b} / 16 + 16" | bc)
# List of expected files
files=(
"aux_params_${size}_rom_length_${rom_length}.bin"
"prover_key_${size}_rom_length_${rom_length}.bin"
"verifier_key_${size}_rom_length_${rom_length}.bin"
)
for file in "${files[@]}"; do
if [ ! -f "$target_dir/artifacts/$file" ]; then
echo "Error: File not found: $file in $target_dir/artifacts"
exit 1
else
echo "Successfully verified: $file"
fi
done
echo "Successfully generated all parameter files for ${size}"
done
- name: Create release artifacts
run: |
# First verify parameter files were created
for target_dir in builds/target_*b; do
size=$(basename "$target_dir" | sed 's/target_//')
# Calculate ROM length the same way as in Makefile
rom_length=$(echo "${size%b} / 16 + 16" | bc)
# List of expected files
files=(
"aux_params_${size}_rom_length_${rom_length}.bin"
"prover_key_${size}_rom_length_${rom_length}.bin"
"verifier_key_${size}_rom_length_${rom_length}.bin"
)
for file in "${files[@]}"; do
if [ ! -f "$target_dir/artifacts/$file" ]; then
echo "Error: File not found: $file in $target_dir/artifacts"
exit 1
else
echo "Successfully verified: $file"
fi
done
echo "Successfully generated all parameter files for ${size}"
# Create zip archive for this target size
if [ -d "$target_dir/artifacts" ]; then
echo "Creating archive for $size"
( cd "$target_dir/artifacts" && \
zip -r "../../../circom-artifacts-${size}-v${{ env.VERSION }}.zip" . )
fi
done
- name: Clean build artifacts
if: always()
run: make clean
- name: Upload artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: circom-artifacts-v${{ env.VERSION }}
path: circom-artifacts-*-v${{ env.VERSION }}.zip
retention-days: 5