lnbits-legend/.github/workflows/migrations.yml
calle 8535d70d36
Poetry dev (#837)
* black and isort for tests

* black and isort for build

* use poetry in Makefile, update pyproject.toml dependencies and add configs for black, pytest, mypy, isort there

* switching github workflow to poetry

* set mininum version to python 3.7

* fix tests

* add types-protobuf to dev packages

* fix cln regtest

* update docs

* try fix 1

* mypy fix2

* fix isort formatting workflow

* add prettier to dev docs

* multiple valid python version for pyproject

* update poetry.lock

* remove development installation, not needed anymore

* fix migration workflows

* format into one test

* fix yaml

* fix pipeline

* fix pipeline

* fix again

* fix

* rename checks

* remove venv tests

* venv test once

Co-authored-by: dni <dni.khr@gmail.com>
2022-08-03 14:10:32 +02:00

47 lines
1.5 KiB
YAML

name: migrations
on: [pull_request]
jobs:
sqlite-to-postgres:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
# maps tcp port 5432 on service container to the host
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2.1.3
- name: Install dependencies
run: |
poetry install
sudo apt install unzip
- name: Run migrations
run: |
rm -rf ./data
mkdir -p ./data
export LNBITS_DATA_FOLDER="./data"
unzip tests/data/mock_data.zip -d ./data
timeout 5s poetry run lnbits --host 0.0.0.0 --port 5001 || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
export LNBITS_DATABASE_URL="postgres://postgres:postgres@0.0.0.0:5432/postgres"
timeout 5s poetry run lnbits --host 0.0.0.0 --port 5001 || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
poetry run python tools/conv.py