Skip to content

Commit c8e2cfe

Browse files
committed
fix(ci): generate env files for docker compose
1 parent aedd8a5 commit c8e2cfe

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,36 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616

17-
# 🔧 REQUIRED: Go for E2E runner
1817
- name: Set up Go
1918
uses: actions/setup-go@v4
2019
with:
2120
go-version: "1.20"
2221

23-
# 🔧 REQUIRED: create .env files from .env.example
24-
- name: Prepare env files for CI
22+
- name: Create env files for CI
2523
run: |
26-
cp services/product/.env.example services/product/.env
27-
cp services/cart/.env.example services/cart/.env
28-
cp services/orders/.env.example services/orders/.env
24+
mkdir -p services/product services/cart services/orders
25+
26+
cat > services/product/.env <<EOF
27+
DATABASE_URL=postgres://postgres:postgres@postgres:5432/sabhyatam?sslmode=disable
28+
ADMIN_KEY=sabhyatam-secret
29+
EOF
30+
31+
cat > services/cart/.env <<EOF
32+
REDIS_ADDR=redis:6379
33+
PRODUCT_SVC_BASE=http://product:8080
34+
EOF
35+
36+
cat > services/orders/.env <<EOF
37+
DATABASE_URL=postgres://postgres:postgres@postgres:5432/sabhyatam?sslmode=disable
38+
PRODUCT_SVC_BASE=http://product:8080
39+
CART_SVC_BASE=http://cart:8081
40+
INTERNAL_SERVICE_KEY=sabhyatam-internal-2025
41+
EOF
2942
30-
# 🚀 Start full stack
3143
- name: Build and start services
3244
run: |
3345
docker compose up -d --build
3446
35-
# ⏳ Wait until all services are ready
3647
- name: Wait for services to be healthy
3748
run: |
3849
echo "Waiting for services..."
@@ -50,18 +61,15 @@ jobs:
5061
docker compose logs
5162
exit 1
5263
53-
# 🧪 Full end-to-end checkout test
5464
- name: Run Full E2E Checkout Flow
5565
run: |
5666
go run ./tools/e2e_checkout/full_flow.go
5767
58-
# 🪵 Debug aid
5968
- name: Dump logs on failure
6069
if: failure()
6170
run: |
6271
docker compose logs
6372
64-
# 🧹 Always cleanup
6573
- name: Shutdown services
6674
if: always()
6775
run: |

0 commit comments

Comments
 (0)