fix: extract circuit #63
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-06-10 | |
- 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: Create release artifacts | |
run: | | |
# Get the list of target directories | |
for target_dir in builds/target_*b; do | |
if [ -d "$target_dir/artifacts" ]; then | |
# Extract the target size from the directory name | |
target_size=$(basename "$target_dir") | |
echo "Creating archive for $target_size" | |
# Create zip file for this target size | |
( cd "$target_dir/artifacts" && \ | |
zip -r "../../../circom-artifacts-${target_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 |