test: make nice pytest reports on github (#2376)

* test: make nice pytest reports on github
utilizing this action: https://github.com/pavelzw/pytest-action/
This commit is contained in:
dni ⚡ 2024-04-05 08:35:51 +02:00 committed by GitHub
parent 820882db28
commit 209e2c5bff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 18 deletions

View file

@ -21,20 +21,18 @@ jobs:
uses: ./.github/workflows/tests.yml
with:
python-version: ${{ matrix.python-version }}
db-url: ${{ matrix.db-url }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
migrations:
migration:
needs: [ lint ]
strategy:
matrix:
python-version: ["3.9"]
uses: ./.github/workflows/tests.yml
python-version: ["3.9", "3.10"]
uses: ./.github/workflows/migration.yml
with:
make: test-migration
db-name: migration
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
python-version: ${{ matrix.python-version }}
openapi:
needs: [ lint ]

View file

@ -49,5 +49,5 @@ jobs:
with:
name: jmeter-extension-test-results
path: |
reports/
logs/
lnbits-extensions/reports/
lnbits-extensions/logs/

37
.github/workflows/migration.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: migration
on:
workflow_call:
inputs:
python-version:
description: "python version"
type: string
default: "3.10"
jobs:
make:
name: migration (${{ inputs.python-version }})
strategy:
matrix:
os-version: ["ubuntu-latest"]
runs-on: ${{ matrix.os-version }}
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: lnbits
POSTGRES_PASSWORD: lnbits
POSTGRES_DB: migration
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 }}
- run: make test-migration

View file

@ -56,7 +56,8 @@ jobs:
if: ${{ inputs.backend-wallet-class == 'LNbitsWallet' }}
run: docker exec lnbits-lnbits-1 poetry run python tools/create_fake_admin.py
- name: Run Tests
- name: Run pytest
uses: pavelzw/pytest-action@v2
env:
LNBITS_DATABASE_URL: ${{ inputs.db-url }}
LNBITS_BACKEND_WALLET_CLASS: ${{ inputs.backend-wallet-class }}
@ -75,7 +76,16 @@ jobs:
LNBITS_KEY: "d08a3313322a4514af75d488bcc27eee"
ECLAIR_URL: http://127.0.0.1:8082
ECLAIR_PASS: lnbits
run: make test-real-wallet
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: "regtest (${{ inputs.python-version }}, ${{ inputs.backend-wallet-class }}"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4

View file

@ -3,9 +3,6 @@ name: tests
on:
workflow_call:
inputs:
make:
default: test
type: string
python-version:
default: "3.9"
type: string
@ -48,15 +45,26 @@ jobs:
with:
python-version: ${{ inputs.python-version }}
- name: Run Tests
- name: Run pytest
uses: pavelzw/pytest-action@v2
env:
LNBITS_DATABASE_URL: ${{ inputs.db-url }}
LNBITS_BACKEND_WALLET_CLASS: FakeWallet
run: make ${{ inputs.make }}
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: true
verbose: false