From 6e5b8f2119b14ccd3cda3e9d934dbbc73f13804a Mon Sep 17 00:00:00 2001 From: feltroidprime Date: Sat, 27 Jul 2024 17:09:46 +0200 Subject: [PATCH] Hydra CI --- .github/workflows/{CI.yml => cairo.yml} | 2 +- .github/workflows/hydra.yml | 44 +++++++++++++++++++++++++ tests/hydra/test_g1_point.py | 4 +++ tools/make/requirements.txt | 5 +-- 4 files changed, 52 insertions(+), 3 deletions(-) rename .github/workflows/{CI.yml => cairo.yml} (93%) create mode 100644 .github/workflows/hydra.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/cairo.yml similarity index 93% rename from .github/workflows/CI.yml rename to .github/workflows/cairo.yml index 0aaeda53..2dd9f62a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/cairo.yml @@ -1,4 +1,4 @@ -name: CI +name: Cairo 1 tests on: push: diff --git a/.github/workflows/hydra.yml b/.github/workflows/hydra.yml new file mode 100644 index 00000000..3a2b0506 --- /dev/null +++ b/.github/workflows/hydra.yml @@ -0,0 +1,44 @@ +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: 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 \ No newline at end of file diff --git a/tests/hydra/test_g1_point.py b/tests/hydra/test_g1_point.py index ffcc55eb..30d9534a 100644 --- a/tests/hydra/test_g1_point.py +++ b/tests/hydra/test_g1_point.py @@ -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) diff --git a/tools/make/requirements.txt b/tools/make/requirements.txt index d08296ff..499efd06 100644 --- a/tools/make/requirements.txt +++ b/tools/make/requirements.txt @@ -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 \ No newline at end of file +python-dotenv +pytest \ No newline at end of file