Skip to content

Commit

Permalink
feat: update CI to setup venv and compile cairo zero prgms
Browse files Browse the repository at this point in the history
  • Loading branch information
zmalatrax committed Jun 20, 2024
1 parent 4cfcb49 commit 98bf46f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 4 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,31 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # v4.1.7
- name: Compile conformance programs
run: #TODO
working-directory: conformance
- uses: actions/checkout@v4
- name: Set up Python 3.10
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Load cached venv
id: cached-dependencies
uses: actions/cache@v3
with:
path: .venv
key:
venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version
}}-${{ hashFiles('requirements.txt') }}

- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "$VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: Compile Cairo Zero programs
run: |
make create-proof-programs-symlinks
make compile
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: create-proof-programs-symlinks
create-proof-programs-symlinks:
cd conformance/proof-programs; ln -s ../cairo-0/*.cairo .

# Compile Cairo Zero Programs

CAIRO_0_DIR=conformance/cairo-0/
CAIRO_0_PROGRAMS:=$(shell find $(CAIRO_0_DIR) -name '*.cairo')
COMPILED_CAIRO_0_PROGRAMS:=$(CAIRO_0_PROGRAMS:%.cairo=%.json)

$(CAIRO_0_DIR)%.json: $(CAIRO_0_DIR)%.cairo
cairo-compile --cairo-path "$(CAIRO_0_DIR)" $< --output $@

# Compile Cairo Zero Proof Programs

CAIRO_0_PROOF_DIR=conformance/proof-programs/
CAIRO_0_PROOF_PROGRAMS:=$(shell find $(CAIRO_0_PROOF_DIR) -name '*.cairo')
COMPILED_CAIRO_0_PROOF_PROGRAMS:=$(CAIRO_0_PROOF_PROGRAMS:%.cairo=%.json)

$(CAIRO_0_PROOF_DIR)%.json: $(CAIRO_0_PROOF_DIR)%.cairo
cairo-compile --cairo_path "$(CAIRO_0_PROOF_DIR)" $< --output $@ --proof_mode

compile: $(COMPILED_CAIRO_0_PROGRAMS) $(COMPILED_CAIRO_0_PROOF_PROGRAMS)

# Clean artifacts

.PHONY: clean
clean:
rm -f $(CAIRO_0_DIR)/*.json
rm -f $(CAIRO_0_PROOF_DIR)/*.cairo
rm -f $(CAIRO_0_PROOF_DIR)/*.json
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ecdsa==0.18.0
bitarray==2.7.3
fastecdsa==2.2.3
sympy==1.11.1
typeguard==2.13.3
cairo-lang==0.13.1

0 comments on commit 98bf46f

Please sign in to comment.