Github CI with Postgres (#417)

* with postgres

* postgres test explicit

* make format

* start postgres only if needed

* remove if again

* print db

* db in matrix

* delete schema

* use new env var MINT_TEST_DATABASE for tests

* add db path to regtest
This commit is contained in:
callebtc
2024-02-11 15:52:02 +01:00
committed by GitHub
parent 78de84f3eb
commit f74f18c9ca
7 changed files with 41 additions and 8 deletions

View File

@@ -17,8 +17,8 @@ jobs:
poetry-version: ["1.7.1"]
mint-cache-secrets: ["false", "true"]
mint-only-deprecated: ["false", "true"]
# db-url: ["", "postgres://cashu:cashu@localhost:5432/cashu"] # TODO: Postgres test not working
db-url: [""]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
# mint-database: [""]
backend-wallet-class: ["FakeWallet"]
uses: ./.github/workflows/tests.yml
with:
@@ -27,6 +27,7 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
mint-cache-secrets: ${{ matrix.mint-cache-secrets }}
mint-only-deprecated: ${{ matrix.mint-only-deprecated }}
mint-database: ${{ matrix.mint-database }}
regtest:
uses: ./.github/workflows/regtest.yml
strategy:
@@ -38,3 +39,4 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
mint-database: "./test_data/test_mint"

View File

@@ -12,7 +12,7 @@ on:
os-version:
default: "ubuntu-latest"
type: string
db-url:
mint-database:
default: ""
type: string
backend-wallet-class:
@@ -23,6 +23,20 @@ jobs:
regtest:
runs-on: ${{ inputs.os-version }}
timeout-minutes: 10
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: cashu
POSTGRES_PASSWORD: cashu
POSTGRES_DB: cashu
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
@@ -47,7 +61,7 @@ jobs:
WALLET_NAME: test_wallet
MINT_HOST: localhost
MINT_PORT: 3337
MINT_DATABASE: ${{ inputs.db-url }}
MINT_TEST_DATABASE: ${{ inputs.mint-database }}
TOR: false
MINT_LIGHTNING_BACKEND: ${{ inputs.backend-wallet-class }}
MINT_LNBITS_ENDPOINT: http://localhost:5001

View File

@@ -9,7 +9,7 @@ on:
poetry-version:
default: "1.7.1"
type: string
db-url:
mint-database:
default: ""
type: string
os:
@@ -24,7 +24,7 @@ on:
jobs:
poetry:
name: Run (mint-cache-secrets ${{ inputs.mint-cache-secrets }}, mint-only-deprecated ${{ inputs.mint-only-deprecated }})
name: Run (mint-cache-secrets ${{ inputs.mint-cache-secrets }}, mint-only-deprecated ${{ inputs.mint-only-deprecated }}, mint-database ${{ inputs.mint-database }})
runs-on: ${{ inputs.os }}
services:
postgres:
@@ -53,7 +53,7 @@ jobs:
WALLET_NAME: test_wallet
MINT_HOST: localhost
MINT_PORT: 3337
MINT_DATABASE: ${{ inputs.db-url }}
MINT_TEST_DATABASE: ${{ inputs.mint-database }}
MINT_CACHE_SECRETS: ${{ inputs.mint-cache-secrets }}
DEBUG_MINT_ONLY_DEPRECATED: ${{ inputs.mint-only-deprecated }}
TOR: false