lnbits-legend/.github/workflows/tests.yml
dni ⚡ 209e2c5bff
test: make nice pytest reports on github (#2376)
* test: make nice pytest reports on github
utilizing this action: https://github.com/pavelzw/pytest-action/
2024-04-05 08:35:51 +02:00

70 lines
1.7 KiB
YAML

name: tests
on:
workflow_call:
inputs:
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
secrets:
CODECOV_TOKEN:
required: true
jobs:
tests:
runs-on: ${{ inputs.os-version }}
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: lnbits
POSTGRES_PASSWORD: lnbits
POSTGRES_DB: ${{ inputs.db-name }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
- name: Run pytest
uses: pavelzw/pytest-action@v2
env:
LNBITS_DATABASE_URL: ${{ inputs.db-url }}
LNBITS_BACKEND_WALLET_CLASS: FakeWallet
FAKE_WALLET_SECRET: "ToTheMoon1"
LNBITS_DATA_FOLDER: "./tests/data"
PYTHONUNBUFFERED: 1
DEBUG: true
with:
verbose: false
job-summary: true
emoji: false
click-to-expand: false
custom-pytest: poetry run pytest
report-title: "test (${{ inputs.python-version }}, ${{ inputs.db-url }})"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: false