From 5ec7e1be693c1e7c6513f1f8e76ea34a928223f8 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Mon, 22 Dec 2025 18:26:17 +0000 Subject: [PATCH 1/3] Use `services` to run postgres and redis --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d1907383..d13ccdb47 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,23 +12,35 @@ jobs: DB_PASSWORD: password SECRET_BASE_KEY: test_key RAILS_ENV: test - REDIS_TEST_URL: redis://localhost:6456/0 + REDIS_TEST_URL: redis://localhost:6379/0 + services: + postgres: + image: postgres:14 + env: + POSTGRES_DB: ${DB_NAME} + POSTGRES_USER: ${DB_USER} + POSTGRES_PASSWORD: ${DB_PASSWORD} + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 steps: - name: Install system dependencies run: | sudo apt-get update sudo apt-get install imagemagick - - name: Set up database - uses: harmon758/postgresql-action@v1 - with: - postgresql db: ${DB_NAME} - postgresql user: ${DB_USER} - postgresql password: ${DB_PASSWORD} - - name: Set up Redis - uses: supercharge/redis-github-action@1.5.0 - with: - redis-version: 6 - redis-port: 6456 - name: Check out code uses: actions/checkout@v4 - name: Install Ruby & gems From f27a1fde82fe3bcacd4be409758431e9eef411e9 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Mon, 22 Dec 2025 18:30:13 +0000 Subject: [PATCH 2/3] Fix env var mapping --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d13ccdb47..f600c4adb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,9 +17,9 @@ jobs: postgres: image: postgres:14 env: - POSTGRES_DB: ${DB_NAME} - POSTGRES_USER: ${DB_USER} - POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_DB: ${{ env.DB_NAME }} + POSTGRES_USER: ${{ env.DB_USER }} + POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} ports: - 5432:5432 options: >- From 9d85501c03929df9c15d821faf55373ca33cbf73 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Mon, 22 Dec 2025 18:36:05 +0000 Subject: [PATCH 3/3] Update deployment checks action too. Unpin postgres version --- .github/workflows/deployment-checks.yml | 31 ++++++++++++++++++------- .github/workflows/test.yml | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deployment-checks.yml b/.github/workflows/deployment-checks.yml index c52968dea..9ba80825f 100644 --- a/.github/workflows/deployment-checks.yml +++ b/.github/workflows/deployment-checks.yml @@ -12,17 +12,32 @@ jobs: DB_PASSWORD: password SECRET_BASE_KEY: test_key RAILS_ENV: production + services: + postgres: + image: postgres + env: + POSTGRES_DB: ${{ env.DB_NAME }} + POSTGRES_USER: ${{ env.DB_USER }} + POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 steps: - - uses: harmon758/postgresql-action@v1 - with: - postgresql db: ${DB_NAME} - postgresql user: ${DB_USER} - postgresql password: ${DB_PASSWORD} - name: Set up database - - uses: actions/checkout@v4 name: Set up Ruby - - uses: ruby/setup-ruby@v1 with: bundler-cache: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f600c4adb..cee5cf256 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: REDIS_TEST_URL: redis://localhost:6379/0 services: postgres: - image: postgres:14 + image: postgres env: POSTGRES_DB: ${{ env.DB_NAME }} POSTGRES_USER: ${{ env.DB_USER }}