Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
0g-peterzhb committed Mar 22, 2024
1 parent 7f5fa6d commit ff64ae7
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 430 deletions.
12 changes: 12 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Setup Rust (cache & toolchain)
runs:
using: composite
steps:
- name: Install toolchain 1.75.0
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.75.0
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: functional-test

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

env:
CARGO_TERM_COLOR: always

jobs:
test:

runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Rust (cache & toolchain)
uses: ./.github/actions/setup-rust

- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build Protobuf
run: |
cp api/proto/disperser/disperser.proto tests/
cd tests && python -m grpc_tools.protoc --proto_path=. ./disperser.proto --python_out=. --grpc_python_out=.
- name: Run tests
run: |
cd tests
python da_test_all.py
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ coverage.*
*log

*__pycache__*
*tmp*
*tmp*
11 changes: 11 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
jsonrpcclient
pyyaml
pysha3
coincurve
eth-utils==1.10.0
py-ecc==5.2.0
web3
eth_tester
rtoml==0.10.0
grpcio
grpcio-tools
2 changes: 0 additions & 2 deletions tests/da_test_framework/da_batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(

local_conf.update(updated_config)
data_dir = os.path.join(root_dir, "da_batcher")
# rpc_url = "http://" + local_conf["rpc_listen_address"]
super().__init__(
DANodeType.DA_BATCHER,
12,
Expand All @@ -38,7 +37,6 @@ def __init__(
log,
None,
)
self.log.info(f'local conf for batcher {local_conf}')
self.args = [binary, "--batcher.pull-interval", "10s",
"--chain.rpc", local_conf['blockchain_rpc_endpoint'],
"--chain.private-key", GENESIS_PRIV_KEY,
Expand Down
1 change: 0 additions & 1 deletion tests/da_test_framework/da_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def __init__(

local_conf.update(updated_config)
data_dir = os.path.join(root_dir, "da_encoder")
# rpc_url = "http://0.0.0.0:34000"
super().__init__(
DANodeType.DA_ENCODER,
11,
Expand Down
2 changes: 0 additions & 2 deletions tests/da_test_framework/da_test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ def setup_nodes(self):
self.da_encoder_binary = self.options.da_encoder
self.da_batcher_binary = self.options.da_batcher
self.da_server_binary = self.options.da_server

self.log.info(f'addresses {self.localstack_binary}, {self.da_encoder_binary}, {self.da_batcher_binary}, {self.da_server_binary}')

self.build_binary()

Expand Down
1 change: 0 additions & 1 deletion tests/da_test_framework/local_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def __init__(

local_conf.update(updated_config)
data_dir = os.path.join(root_dir, "localstack")
# rpc_url = "http://0.0.0.0:4566"
super().__init__(
DANodeType.DA_LOCAL_STACK,
10,
Expand Down
4 changes: 3 additions & 1 deletion tests/dep_pip3.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

pip3 install -r ../0g_storage_kv/tests/requirements.txt
pip3 install -r ../requirements.txt
cp ../api/proto/disperser/disperser.proto .
python -m grpc_tools.protoc --proto_path=. ./disperser.proto --python_out=. --grpc_python_out=.
221 changes: 0 additions & 221 deletions tests/disperser.proto

This file was deleted.

Loading

0 comments on commit ff64ae7

Please sign in to comment.