2022-10-20 13:30:44 +00:00
|
|
|
name: "Test: Coordinator"
|
2022-07-13 18:55:30 +00:00
|
|
|
|
|
|
|
on:
|
2022-07-13 20:40:58 +00:00
|
|
|
workflow_dispatch:
|
2022-09-20 17:39:49 +00:00
|
|
|
workflow_call:
|
2022-07-13 18:55:30 +00:00
|
|
|
push:
|
|
|
|
branches: [ "main" ]
|
|
|
|
paths: ["api", "chat", "control", "robosats"]
|
2023-10-23 22:48:38 +00:00
|
|
|
pull_request_target:
|
2022-07-13 18:55:30 +00:00
|
|
|
branches: [ "main" ]
|
|
|
|
paths: ["api", "chat", "control", "robosats"]
|
|
|
|
|
2023-10-23 22:48:38 +00:00
|
|
|
concurrency:
|
|
|
|
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
|
|
|
cancel-in-progress: true
|
2022-10-25 18:04:12 +00:00
|
|
|
|
2022-07-13 18:55:30 +00:00
|
|
|
jobs:
|
2023-11-13 14:40:47 +00:00
|
|
|
test:
|
2022-07-13 18:55:30 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-09-09 00:46:10 +00:00
|
|
|
timeout-minutes: 30
|
2022-07-13 18:55:30 +00:00
|
|
|
strategy:
|
2023-11-30 15:53:30 +00:00
|
|
|
max-parallel: 2
|
2022-07-13 18:55:30 +00:00
|
|
|
matrix:
|
2024-04-21 20:52:13 +00:00
|
|
|
python-tag: ['3.12.3-slim-bookworm', '3.13-rc-slim-bookworm']
|
2024-09-09 00:46:10 +00:00
|
|
|
lnd-version: ['v0.18.2-beta']
|
|
|
|
cln-version: ['v24.08']
|
2024-06-17 21:33:49 +00:00
|
|
|
ln-vendor: ['LND', 'CLN']
|
2022-07-13 18:55:30 +00:00
|
|
|
|
|
|
|
steps:
|
2022-07-13 20:40:58 +00:00
|
|
|
- name: 'Checkout'
|
2023-09-11 16:00:32 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-10-23 22:48:38 +00:00
|
|
|
|
2023-11-14 01:42:04 +00:00
|
|
|
- name: Patch Dockerfile and .env-sample
|
2023-11-13 14:40:47 +00:00
|
|
|
run: |
|
|
|
|
sed -i "1s/FROM python:.*/FROM python:${{ matrix.python-tag }}/" Dockerfile
|
2023-11-14 01:42:04 +00:00
|
|
|
sed -i "s/^LNVENDOR=.*/LNVENDOR='${{ matrix.ln-vendor }}'/" .env-sample
|
2023-10-23 22:48:38 +00:00
|
|
|
|
2023-11-13 14:40:47 +00:00
|
|
|
- uses: satackey/action-docker-layer-caching@v0.0.11
|
|
|
|
continue-on-error: true
|
|
|
|
with:
|
2024-01-09 01:29:11 +00:00
|
|
|
key: coordinator-docker-cache-${{ hashFiles('Dockerfile', 'requirements.txt', 'requirements_dev.txt') }}-${{ matrix.ln-vendor }}
|
2023-11-13 14:40:47 +00:00
|
|
|
restore-keys: |
|
|
|
|
coordinator-docker-cache-
|
2023-10-23 22:48:38 +00:00
|
|
|
|
2023-11-13 14:40:47 +00:00
|
|
|
- name: 'Compose Regtest Orchestration'
|
|
|
|
uses: isbang/compose-action@v1.5.1
|
|
|
|
with:
|
|
|
|
compose-file: "./docker-tests.yml"
|
|
|
|
down-flags: "--volumes"
|
|
|
|
services: |
|
|
|
|
bitcoind
|
|
|
|
postgres
|
|
|
|
redis
|
2023-11-14 01:42:04 +00:00
|
|
|
coordinator-${{ matrix.ln-vendor }}
|
2023-11-13 14:40:47 +00:00
|
|
|
robot-LND
|
|
|
|
coordinator
|
|
|
|
env:
|
|
|
|
LND_VERSION: ${{ matrix.lnd-version }}
|
|
|
|
CLN_VERSION: ${{ matrix.cln-version }}
|
|
|
|
ROBOSATS_ENVS_FILE: ".env-sample"
|
2023-11-12 12:39:39 +00:00
|
|
|
|
2023-11-13 14:40:47 +00:00
|
|
|
- name: Wait for coordinator (django server)
|
|
|
|
run: |
|
|
|
|
while [ "$(docker inspect --format "{{.State.Health.Status}}" coordinator)" != "healthy" ]; do
|
|
|
|
echo "Waiting for coordinator to be healthy..."
|
|
|
|
sleep 5
|
|
|
|
done
|
2023-10-23 22:48:38 +00:00
|
|
|
|
|
|
|
- name: 'Run tests with coverage'
|
2022-07-13 18:55:30 +00:00
|
|
|
run: |
|
2023-11-12 12:39:39 +00:00
|
|
|
docker exec coordinator coverage run manage.py test
|
|
|
|
docker exec coordinator coverage report
|
2023-11-29 11:26:09 +00:00
|
|
|
docker exec coordinator coverage html
|
2023-11-13 14:40:47 +00:00
|
|
|
env:
|
|
|
|
LNVENDOR: ${{ matrix.ln-vendor }}
|
|
|
|
DEVELOPMENT: True
|
2023-11-29 11:26:09 +00:00
|
|
|
USE_TOR: False
|
|
|
|
|
|
|
|
- name: 'Upload coverage report'
|
2023-12-25 13:20:19 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-11-29 11:26:09 +00:00
|
|
|
with:
|
2024-01-09 01:24:54 +00:00
|
|
|
name: coverage-report-${{ matrix.python-tag }}-${{ matrix.ln-vendor }}-${{ github.run_id }}
|
2023-11-29 11:26:09 +00:00
|
|
|
path: htmlcov/
|