feat: Configure CI tests with a dedicated PostgreSQL service and environment variables.

This commit is contained in:
syntaxbullet
2026-01-30 15:41:34 +01:00
parent 5ff3fa9ab5
commit db859e8f12
2 changed files with 41 additions and 1 deletions

6
.env.test Normal file
View File

@@ -0,0 +1,6 @@
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/aurora_test"
DISCORD_BOT_TOKEN="test_token"
DISCORD_CLIENT_ID="123456789"
DISCORD_GUILD_ID="123456789"
ADMIN_TOKEN="admin_token_123"
LOG_LEVEL="error"

View File

@@ -18,6 +18,21 @@ jobs:
# ==========================================================================
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: aurora_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -30,8 +45,27 @@ jobs:
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Setup Test Database
run: bun run db:push:local
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/aurora_test
# Create .env.test for implicit usage by bun
DISCORD_BOT_TOKEN: test_token
DISCORD_CLIENT_ID: 123
DISCORD_GUILD_ID: 123
- name: Run Tests
run: bash shared/scripts/test-sequential.sh
run: |
# Create .env.test for test-sequential.sh / bun test
cat <<EOF > .env.test
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/aurora_test"
DISCORD_BOT_TOKEN="test_token"
DISCORD_CLIENT_ID="123456789"
DISCORD_GUILD_ID="123456789"
ADMIN_TOKEN="admin_token_123"
LOG_LEVEL="error"
EOF
bash shared/scripts/test-sequential.sh
# ==========================================================================
# Build Job