Initial Commit
This commit is contained in:
65
.github/workflows/ci.yml
vendored
Normal file
65
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build-and-test-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build core services
|
||||
run: |
|
||||
docker compose -p ci build backend frontend mvp-platform-vehicles-api
|
||||
|
||||
- name: Start dependencies for tests
|
||||
run: |
|
||||
docker compose -p ci up -d postgres redis minio mvp-platform-vehicles-db mvp-platform-vehicles-redis mvp-platform-vehicles-api
|
||||
# Wait for platform API health
|
||||
for i in {1..30}; do
|
||||
if docker compose -p ci ps --status=running | grep -q mvp-platform-vehicles-api; then
|
||||
curl -sf http://localhost:8000/health && break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Build backend builder image (with dev deps)
|
||||
run: |
|
||||
docker build -t motovaultpro-backend-builder --target builder backend
|
||||
|
||||
- name: Lint backend
|
||||
run: |
|
||||
docker run --rm --network ci_default --env-file .env \
|
||||
motovaultpro-backend-builder npm run lint
|
||||
|
||||
- name: Run backend tests
|
||||
env:
|
||||
CI: true
|
||||
run: |
|
||||
docker run --rm --network ci_default --env-file .env \
|
||||
-e DB_HOST=postgres -e REDIS_HOST=redis -e MINIO_ENDPOINT=minio \
|
||||
-e PLATFORM_VEHICLES_API_URL=http://mvp-platform-vehicles-api:8000 \
|
||||
-e PLATFORM_VEHICLES_API_KEY=mvp-platform-vehicles-secret-key \
|
||||
motovaultpro-backend-builder npm test -- --runInBand
|
||||
|
||||
build-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build frontend image
|
||||
run: |
|
||||
docker compose -p ci build frontend
|
||||
|
||||
Reference in New Issue
Block a user