From 6ddf019a8233022d1cf4dd8224c82a75fe7d3618 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:56:27 +0100 Subject: [PATCH] start postgres only if needed --- .github/workflows/ci.yml | 4 ++-- .github/workflows/regtest.yml | 19 +++++++++++++++++-- .github/workflows/tests.yml | 5 +++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bc78fa7..3fef618b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: ["", "postgres://cashu:cashu@localhost:5432/cashu"] + # mint-database: [""] backend-wallet-class: ["FakeWallet"] uses: ./.github/workflows/tests.yml with: diff --git a/.github/workflows/regtest.yml b/.github/workflows/regtest.yml index 48653736..8255b503 100644 --- a/.github/workflows/regtest.yml +++ b/.github/workflows/regtest.yml @@ -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,21 @@ 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 + if: startsWith(inputs.mint-database, 'postgres') steps: - uses: actions/checkout@v3 @@ -47,7 +62,7 @@ jobs: WALLET_NAME: test_wallet MINT_HOST: localhost MINT_PORT: 3337 - MINT_DATABASE: ${{ inputs.db-url }} + MINT_DATABASE: ${{ inputs.mint-database }} TOR: false MINT_LIGHTNING_BACKEND: ${{ inputs.backend-wallet-class }} MINT_LNBITS_ENDPOINT: http://localhost:5001 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6659b06a..96a5ea63 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: poetry-version: default: "1.7.1" type: string - db-url: + mint-database: default: "" type: string os: @@ -40,6 +40,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + if: startsWith(inputs.mint-database, 'postgres') steps: - name: Checkout repository and submodules uses: actions/checkout@v2 @@ -53,7 +54,7 @@ jobs: WALLET_NAME: test_wallet MINT_HOST: localhost MINT_PORT: 3337 - MINT_DATABASE: ${{ inputs.db-url }} + MINT_DATABASE: ${{ inputs.mint-database }} MINT_CACHE_SECRETS: ${{ inputs.mint-cache-secrets }} DEBUG_MINT_ONLY_DEPRECATED: ${{ inputs.mint-only-deprecated }} TOR: false