mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-20 03:44:25 +00:00
feat: Add PostgreSQL service and database migrations to Rust component test jobs in CI workflow
- Upgrade PostgreSQL service from version 15 to 18 in api-server-test job - Add PostgreSQL 18 service configuration to charging-engine-test and packet-gateway-test jobs - Configure database health checks with pg_isready command for all Postgres services - Add goose installation step to charging-engine-test and packet-gateway-test jobs - Add database migration execution step before running tests in Rust components
This commit is contained in:
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: test_user
|
||||
POSTGRES_PASSWORD: test_password
|
||||
@@ -110,6 +110,20 @@ jobs:
|
||||
charging-engine-test:
|
||||
name: Charging Engine Tests
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: test_user
|
||||
POSTGRES_PASSWORD: test_password
|
||||
POSTGRES_DB: test_db
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -134,6 +148,14 @@ jobs:
|
||||
working-directory: apps/charging-engine
|
||||
run: cargo fetch
|
||||
|
||||
- name: Install goose
|
||||
run: go install github.com/pressly/goose/v3/cmd/goose@latest
|
||||
|
||||
- name: Run database migrations
|
||||
env:
|
||||
DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db?sslmode=disable
|
||||
run: goose postgres $DATABASE_URL up migrations
|
||||
|
||||
- name: Run tests
|
||||
working-directory: apps/charging-engine
|
||||
run: cargo test --release || true
|
||||
@@ -145,6 +167,20 @@ jobs:
|
||||
packet-gateway-test:
|
||||
name: Packet Gateway Tests
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18
|
||||
env:
|
||||
POSTGRES_USER: test_user
|
||||
POSTGRES_PASSWORD: test_password
|
||||
POSTGRES_DB: test_db
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -169,6 +205,14 @@ jobs:
|
||||
working-directory: apps/packet-gateway
|
||||
run: cargo fetch
|
||||
|
||||
- name: Install goose
|
||||
run: go install github.com/pressly/goose/v3/cmd/goose@latest
|
||||
|
||||
- name: Run database migrations
|
||||
env:
|
||||
DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db?sslmode=disable
|
||||
run: goose postgres $DATABASE_URL up migrations
|
||||
|
||||
- name: Run tests
|
||||
working-directory: apps/packet-gateway
|
||||
run: cargo test --release || true
|
||||
|
||||
Reference in New Issue
Block a user