Create django.yml

This commit is contained in:
Reckless_Satoshi 2022-07-13 18:55:30 +00:00 committed by Reckless_Satoshi
parent 94ecfe3929
commit 03e4bbc1a5
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 59 additions and 2 deletions

View File

@ -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.

56
.github/workflows/django.yml vendored Normal file
View File

@ -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

View File

@ -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