diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bc6fc4..b05af06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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