From be72ff9f931954db6ef4d91ecdf31a3b3038a013 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 5 Mar 2026 10:32:03 -0600 Subject: [PATCH] ci: set DATABASE_URL globally for test job - Move MIX_ENV and DATABASE_URL to job-level env vars - Removes need to set them on individual steps - Ensures all database operations use correct hostname (postgres) - Fixes 'connection refused' errors from hardcoded localhost in test.exs --- .forgejo/workflows/build.yaml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 7e41bcf5..a4c88f98 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -16,6 +16,9 @@ concurrency: jobs: test: runs-on: ubuntu-22.04 + env: + MIX_ENV: test + DATABASE_URL: postgresql://postgres:postgres@postgres:5432/towerops_test services: postgres: image: timescale/timescaledb:latest-pg17 @@ -84,26 +87,18 @@ jobs: - name: Setup database run: mix ecto.create - env: - MIX_ENV: test - DATABASE_URL: postgresql://postgres:postgres@postgres:5432/towerops_test - name: Check code formatting run: mix format --check-formatted - name: Compile with warnings as errors run: mix compile --warnings-as-errors - env: - MIX_ENV: test - name: Run Credo run: mix credo --strict - name: Run tests run: mix test --warnings-as-errors - env: - MIX_ENV: test - DATABASE_URL: postgresql://postgres:postgres@postgres:5432/towerops_test build: runs-on: ubuntu-22.04