From 8e0991e2fedaf9bb758ae26f6967abb6b786735d Mon Sep 17 00:00:00 2001 From: Peter Zhang Date: Fri, 22 Mar 2024 11:08:34 +0800 Subject: [PATCH] add ci --- .github/actions/setup-rust/action.yml | 12 +++++++ .github/workflows/tests.yml | 45 +++++++++++++++++++++++++++ .gitignore | 2 +- requirements.txt | 11 +++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/actions/setup-rust/action.yml create mode 100644 .github/workflows/tests.yml create mode 100644 requirements.txt diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml new file mode 100644 index 0000000..c843231 --- /dev/null +++ b/.github/actions/setup-rust/action.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..0074e31 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 diff --git a/.gitignore b/.gitignore index e7d31df..f44e8a4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ coverage.* *log *__pycache__* -*tmp* \ No newline at end of file +*tmp* diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4dc1810 --- /dev/null +++ b/requirements.txt @@ -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