2020-09-03 23:02:15 +02:00
|
|
|
name: tests
|
2020-04-28 23:09:59 +02:00
|
|
|
|
2023-08-24 12:36:37 +02:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
make:
|
|
|
|
default: test
|
|
|
|
type: string
|
|
|
|
python-version:
|
|
|
|
default: "3.9"
|
|
|
|
type: string
|
|
|
|
os-version:
|
|
|
|
default: "ubuntu-latest"
|
|
|
|
type: string
|
|
|
|
db-url:
|
|
|
|
default: ""
|
|
|
|
type: string
|
|
|
|
db-name:
|
|
|
|
default: "lnbits"
|
|
|
|
type: string
|
2020-04-28 23:09:59 +02:00
|
|
|
|
|
|
|
jobs:
|
2023-08-24 12:36:37 +02:00
|
|
|
tests:
|
|
|
|
runs-on: ${{ inputs.os-version }}
|
|
|
|
|
2022-07-28 11:23:03 +01:00
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:latest
|
|
|
|
env:
|
2023-08-24 12:36:37 +02:00
|
|
|
POSTGRES_USER: lnbits
|
|
|
|
POSTGRES_PASSWORD: lnbits
|
|
|
|
POSTGRES_DB: ${{ inputs.db-name }}
|
2022-07-28 11:23:03 +01:00
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
2023-08-24 12:36:37 +02:00
|
|
|
|
2022-07-28 11:23:03 +01:00
|
|
|
steps:
|
2023-01-29 11:46:20 +01:00
|
|
|
- uses: actions/checkout@v3
|
2023-08-24 12:36:37 +02:00
|
|
|
|
|
|
|
- uses: ./.github/actions/prepare
|
2023-01-29 11:46:20 +01:00
|
|
|
with:
|
2023-08-24 12:36:37 +02:00
|
|
|
python-version: ${{ inputs.python-version }}
|
|
|
|
|
|
|
|
- name: Run Tests
|
2022-07-28 11:23:03 +01:00
|
|
|
env:
|
2023-08-24 12:36:37 +02:00
|
|
|
LNBITS_DATABASE_URL: ${{ inputs.db-url }}
|
|
|
|
LNBITS_BACKEND_WALLET_CLASS: FakeWallet
|
|
|
|
run: make ${{ inputs.make }}
|
|
|
|
|
2022-07-28 11:23:03 +01:00
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
2022-08-03 14:10:32 +02:00
|
|
|
file: ./coverage.xml
|