Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add CI for examples #12

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: examples

on:
pull_request:
merge_group:
push:
branches: [main]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- uses: dtolnay/rust-toolchain@stable

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Run Forge build
id: build
run: forge build --root chapter1

- name: Rust BLS multisig example
run: cargo run --manifest-path ./chapter1/bls-multisig/rust/Cargo.toml

- name: Python BLS multisig example
run: |
pip install web3 py_ecc
python ./chapter1/bls-multisig/python/multisig.py
2 changes: 1 addition & 1 deletion chapter1/bls-multisig/python/multisig.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def sign_operation(sks: list[int], operation: Operation) -> G2Point:

async def main():
bls_multisig_artifact = json.load(
open(pathlib.Path(__file__).parent.parent.parent.parent / "out/BLSMultisig.sol/BLSMultisig.json")
open(pathlib.Path(__file__).parent.parent.parent / "contracts/out/BLSMultisig.sol/BLSMultisig.json")
)

web3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider("http://localhost:8545"))
Expand Down
3 changes: 2 additions & 1 deletion chapter1/contracts/test/SimpleDelegateContract.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ contract SimpleDelegateContractTest is Test {
// make it forward all calls to the deployed contract
vm.etch(ALICE, bytes.concat(hex"ef0100", abi.encodePacked(delegation)));

ALICE.call{value: 1e18}("");
(bool success,) = ALICE.call{value: 1e18}("");
require(success);

SimpleDelegateContract.Call[] memory calls = new SimpleDelegateContract.Call[](1);
calls[0] = SimpleDelegateContract.Call({data: "", to: address(0), value: 1e18});
Expand Down