Skip to content

Commit

Permalink
chore: add CI for examples (#12)
Browse files Browse the repository at this point in the history
add ci for examples
  • Loading branch information
klkvr authored Oct 10, 2024
1 parent 01007ef commit 28750eb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
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

0 comments on commit 28750eb

Please sign in to comment.