2020-09-03 23:02:15 +02:00
|
|
|
name: tests
|
2020-04-28 23:09:59 +02:00
|
|
|
|
2022-10-06 17:51:36 +01:00
|
|
|
on: [push, pull_request]
|
2020-04-28 23:09:59 +02:00
|
|
|
|
|
|
|
jobs:
|
2022-07-23 10:39:58 +02:00
|
|
|
venv-sqlite:
|
2020-04-28 23:09:59 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-09-27 17:44:52 +02:00
|
|
|
python-version: ["3.9"]
|
|
|
|
poetry-version: ["1.2.1"]
|
2020-04-28 23:09:59 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-06-27 00:11:46 +02:00
|
|
|
uses: actions/setup-python@v2
|
2020-04-28 23:09:59 +02:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
2022-12-07 13:57:08 +01:00
|
|
|
env:
|
2021-11-17 10:53:32 -06:00
|
|
|
VIRTUAL_ENV: ./venv
|
|
|
|
PATH: ${{ env.VIRTUAL_ENV }}/bin:${{ env.PATH }}
|
2020-04-28 23:09:59 +02:00
|
|
|
run: |
|
2021-11-17 10:53:32 -06:00
|
|
|
python -m venv ${{ env.VIRTUAL_ENV }}
|
|
|
|
./venv/bin/python -m pip install --upgrade pip
|
|
|
|
./venv/bin/pip install -r requirements.txt
|
2022-07-07 18:29:26 +02:00
|
|
|
./venv/bin/pip install pytest pytest-asyncio pytest-cov requests mock
|
2021-11-17 10:53:32 -06:00
|
|
|
- name: Run tests
|
2022-08-03 14:10:32 +02:00
|
|
|
run: make test-venv
|
|
|
|
sqlite:
|
2022-07-07 18:29:26 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-09-27 17:44:52 +02:00
|
|
|
python-version: ["3.9"]
|
|
|
|
poetry-version: ["1.2.1"]
|
2022-07-07 18:29:26 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2022-09-27 17:44:52 +02:00
|
|
|
- name: Set up Poetry ${{ matrix.poetry-version }}
|
|
|
|
uses: abatilo/actions-poetry@v2
|
|
|
|
with:
|
|
|
|
poetry-version: ${{ matrix.poetry-version }}
|
2022-07-07 18:29:26 +02:00
|
|
|
- name: Install dependencies
|
2022-07-13 01:15:48 +02:00
|
|
|
run: |
|
2022-08-03 14:10:32 +02:00
|
|
|
poetry install
|
2022-07-13 01:15:48 +02:00
|
|
|
- name: Run tests
|
2022-07-28 11:23:03 +01:00
|
|
|
run: make test
|
2022-08-03 14:10:32 +02:00
|
|
|
postgres:
|
2022-07-28 11:23:03 +01:00
|
|
|
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:
|
2022-09-27 17:44:52 +02:00
|
|
|
python-version: ["3.9"]
|
|
|
|
poetry-version: ["1.2.1"]
|
2022-07-28 11:23:03 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2022-09-27 17:44:52 +02:00
|
|
|
- name: Set up Poetry ${{ matrix.poetry-version }}
|
|
|
|
uses: abatilo/actions-poetry@v2
|
|
|
|
with:
|
|
|
|
poetry-version: ${{ matrix.poetry-version }}
|
2022-07-28 11:23:03 +01:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2022-08-03 14:10:32 +02:00
|
|
|
poetry install
|
2022-07-28 11:23:03 +01:00
|
|
|
- name: Run tests
|
|
|
|
env:
|
|
|
|
LNBITS_DATABASE_URL: postgres://postgres:postgres@0.0.0.0:5432/postgres
|
|
|
|
run: make test
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
2022-08-03 14:10:32 +02:00
|
|
|
file: ./coverage.xml
|