Skip to content

Commit

Permalink
CI for hydra
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Jul 27, 2024
1 parent 1776088 commit f2fbcbb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml → .github/workflows/cairo.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Cairo 1 tests

on:
push:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/hydra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Hydra backend test

on:
push:
merge_group:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.10
- name: Cache Python packages
uses: actions/cache@v3
with:
path: |
~/.cache/pip
venv
key: ${{ runner.os }}-pip-${{ hashFiles('tools/make/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
echo 'export PYTHONPATH="$PWD:$PYTHONPATH"' >> venv/bin/activate
pip install -r tools/make/requirements.txt
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '^1.17'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

- name: Compile Gnark
run: make go
- name: Compile Rust bindings with maturin
run: |
source venv/bin/activate
cd tools/hades_binding
maturin develop --release
- name: Run pytest
run: |
source venv/bin/activate
pytest tests/hydra/ -n auto
4 changes: 4 additions & 0 deletions tests/hydra/test_g1_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def test_weierstrass_to_twistededwards_and_back(curve_id):

@pytest.mark.parametrize("curve_id", curve_ids)
def test_fp_generator(curve_id):
if curve_id == CurveID.BLS12_381:
pytest.skip(
"Skipping test for curve BLS12_381, it's a bit too slow to factorize p-1, but already tested. Uncomment to convince yourself."
)
g = CURVES[curve_id.value].fp_generator
p = CURVES[curve_id.value].p
assert is_generator(g, p)
Expand Down
5 changes: 3 additions & 2 deletions tools/make/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cairo-lang==0.13.0
cairo-lang==0.13.2a0
protobuf==3.20.3
inquirer
pandas
tabulate
pyarrow
maturin
python-dotenv
python-dotenv
pytest

0 comments on commit f2fbcbb

Please sign in to comment.