diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 00000000..6cf80ac1 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,33 @@ +name: Python CI + +on: + push: + branches: [ master ] + tags: ['v*'] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install protoc + run: sudo apt install protobuf-compiler + - name: Install requirements + run: pip install -r requirements.txt + - name: Build python module + run: mkdir generated && protoc -I src --python_betterproto_out=generated/ src/*.proto src/service/*.proto + # Appears related to https://github.com/danielgtaylor/python-betterproto/issues/238 but we need the latest beta of + # betterproto to build src/service/*.proto + - name: Trim python module + run: sed -i '/from . import /d' generated/helium/__init__.py + - name: Python artifact + uses: actions/upload-artifact@v2 + with: + name: helium_proto + path: generated/helium diff --git a/requirements.in b/requirements.in new file mode 100644 index 00000000..f8f80252 --- /dev/null +++ b/requirements.in @@ -0,0 +1 @@ +betterproto[compiler]>=2.0.0b4,<3 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..583a3b25 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,38 @@ +# +# This file is autogenerated by pip-compile with python 3.10 +# To update, run: +# +# pip-compile +# +betterproto[compiler]==2.0.0b4 + # via -r requirements.in +black==22.1.0 + # via betterproto +click==8.0.3 + # via black +grpclib==0.4.2 + # via betterproto +h2==4.1.0 + # via grpclib +hpack==4.0.0 + # via h2 +hyperframe==6.0.1 + # via h2 +jinja2==2.11.3 + # via betterproto +markupsafe==2.0.1 + # via jinja2 +multidict==6.0.2 + # via grpclib +mypy-extensions==0.4.3 + # via black +pathspec==0.9.0 + # via black +platformdirs==2.5.0 + # via black +python-dateutil==2.8.2 + # via betterproto +six==1.16.0 + # via python-dateutil +tomli==2.0.1 + # via black diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 00000000..a801cbb7 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1 @@ +pip-tools>=6.5.1,<7 diff --git a/src/blockchain_block.proto b/src/blockchain_block.proto index c280fd73..cb181727 100644 --- a/src/blockchain_block.proto +++ b/src/blockchain_block.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package helium; + import "blockchain_block_v1.proto"; message blockchain_block { diff --git a/src/blockchain_block_v1.proto b/src/blockchain_block_v1.proto index 2ab5005b..62c5b837 100644 --- a/src/blockchain_block_v1.proto +++ b/src/blockchain_block_v1.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package helium; + import "blockchain_txn.proto"; message blockchain_signature_v1 { diff --git a/src/blockchain_gossip_handler.proto b/src/blockchain_gossip_handler.proto index 344a5fb6..87bf2712 100644 --- a/src/blockchain_gossip_handler.proto +++ b/src/blockchain_gossip_handler.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package helium; + message blockchain_gossip_block { bytes from = 1; bytes block = 2; diff --git a/src/blockchain_snapshot_handler.proto b/src/blockchain_snapshot_handler.proto index 66cbfbcb..9483618a 100644 --- a/src/blockchain_snapshot_handler.proto +++ b/src/blockchain_snapshot_handler.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package helium; + message blockchain_snapshot_req { uint64 height = 1; bytes hash = 2; diff --git a/src/blockchain_sync_handler.proto b/src/blockchain_sync_handler.proto index 666056d6..cffe0500 100644 --- a/src/blockchain_sync_handler.proto +++ b/src/blockchain_sync_handler.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package helium; + message blockchain_sync_hash { bytes hash = 1; repeated uint64 heights = 2; diff --git a/src/blockchain_txn_poc_receipts_v1.proto b/src/blockchain_txn_poc_receipts_v1.proto index 2353a567..709ea1e2 100644 --- a/src/blockchain_txn_poc_receipts_v1.proto +++ b/src/blockchain_txn_poc_receipts_v1.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package helium; enum origin { - p2p = 0; - radio = 1; + origin_p2p = 0; + origin_radio = 1; } message blockchain_poc_receipt_v1 { diff --git a/src/service/gateway.proto b/src/service/gateway.proto index 857a3fee..dd49e724 100644 --- a/src/service/gateway.proto +++ b/src/service/gateway.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package helium; -import "blockchain_state_channel_v1.proto"; import "blockchain_txn_state_channel_close_v1.proto"; import "blockchain_txn_vars_v1.proto";