From e364cb3c9398718a912d78dc8e55b8ff6506d9f2 Mon Sep 17 00:00:00 2001 From: Elad Kaplan Date: Thu, 21 Dec 2023 12:39:21 -0800 Subject: [PATCH] adding db and redis services in starters github workflows --- starters/rest-api/.github/workflows/ci.yaml | 27 ++++++++++++++++++++ starters/saas/.github/workflows/ci.yaml | 28 +++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/starters/rest-api/.github/workflows/ci.yaml b/starters/rest-api/.github/workflows/ci.yaml index 15ee4a6a2..76d3258ff 100644 --- a/starters/rest-api/.github/workflows/ci.yaml +++ b/starters/rest-api/.github/workflows/ci.yaml @@ -63,6 +63,30 @@ jobs: permissions: contents: read + services: + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - "6379:6379" + postgres: + image: postgres + env: + POSTGRES_DB: postgress_test + POSTGRES_USER: postgress + POSTGRES_PASSWORD: postgress + ports: + - "5432:5432" + # Set health checks to wait until postgres has started + options: --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: - name: Checkout the code uses: actions/checkout@v4 @@ -78,3 +102,6 @@ jobs: with: command: test args: --all-features --all + env: + REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}} + DATABASE_URL: postgres://postgress:postgress@localhost:5432/postgress_test diff --git a/starters/saas/.github/workflows/ci.yaml b/starters/saas/.github/workflows/ci.yaml index 15ee4a6a2..87f450b8e 100644 --- a/starters/saas/.github/workflows/ci.yaml +++ b/starters/saas/.github/workflows/ci.yaml @@ -62,6 +62,30 @@ jobs: permissions: contents: read + + services: + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - "6379:6379" + postgres: + image: postgres + env: + POSTGRES_DB: postgress_test + POSTGRES_USER: postgress + POSTGRES_PASSWORD: postgress + ports: + - "5432:5432" + # Set health checks to wait until postgres has started + options: --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - name: Checkout the code @@ -78,3 +102,7 @@ jobs: with: command: test args: --all-features --all + env: + REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}} + DATABASE_URL: postgres://postgress:postgress@localhost:5432/postgress_test +