From 03e4bbc1a5f8f40bc90733b0f85529714c0bbd05 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com> Date: Wed, 13 Jul 2022 18:55:30 +0000 Subject: [PATCH] Create django.yml --- .env-sample | 2 ++ .github/workflows/django.yml | 56 ++++++++++++++++++++++++++++++++++++ Dockerfile | 3 +- 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/django.yml diff --git a/.env-sample b/.env-sample index 0d4ac85d..55c9d7cc 100644 --- a/.env-sample +++ b/.env-sample @@ -20,6 +20,8 @@ POSTGRES_PORT='5432' # To disable auto unlock, comment out 'wallet-unlock-password-file=/tmp/pwd' from 'docker/lnd/lnd.conf' AUTO_UNLOCK_PWD='1234' +LND_GRPC_HOST='localhost:10009' + REDIS_URL='redis://localhost:6379/1' # List of market price public APIs. If the currency is available in more than 1 API, will use median price. diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 00000000..e7c1f1c9 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,56 @@ +name: Django Tests + +on: + push: + branches: [ "main" ] + paths: ["api", "chat", "control", "robosats"] + pull_request: + branches: [ "main" ] + paths: ["api", "chat", "control", "robosats"] + +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + env: + DEVELOPMENT: 1 + strategy: + max-parallel: 4 + matrix: + python-version: ["3.10.2"] + + steps: + - uses: actions/checkout@v3 + - name: 'Set up Python ${{ matrix.python-version }}' + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: 'Install Python Dependencies' + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: 'Install LND gRPC Dependencies' + run: | + cd api/lightning + git clone https://github.com/googleapis/googleapis.git + curl -o lightning.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/lightning.proto + python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. lightning.proto + curl -o invoices.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/invoicesrpc/invoices.proto + python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. invoices.proto + curl -o router.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/routerrpc/router.proto + python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. router.proto + sed -i 's/^import .*_pb2 as/from . \0/' router_pb2.py + sed -i 's/^import .*_pb2 as/from . \0/' invoices_pb2.py + sed -i 's/^import .*_pb2 as/from . \0/' router_pb2_grpc.py + sed -i 's/^import .*_pb2 as/from . \0/' lightning_pb2_grpc.py + sed -i 's/^import .*_pb2 as/from . \0/' invoices_pb2_grpc.py + + - name: 'Create .env File' + run: | + mv .env-sample .env + - name: 'Tests' + run: | + python manage.py test diff --git a/Dockerfile b/Dockerfile index 255d80a5..2c012c19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,7 @@ RUN pip install --no-cache-dir -r requirements.txt # copy current dir's content to container's WORKDIR root i.e. all the contents of the robosats app COPY . . -# fit lnd grpc services -RUN pip install grpcio grpcio-tools googleapis-common-protos +# install lnd grpc services RUN cd api/lightning && git clone https://github.com/googleapis/googleapis.git RUN cd api/lightning && curl -o lightning.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/lightning.proto RUN cd api/lightning && python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. lightning.proto