This commit is contained in:
Ho Ngoc Hai
2025-12-27 01:31:10 +07:00
commit 4da46b5b8e
205 changed files with 21063 additions and 0 deletions

73
.github/workflows/ci-auth-service.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: Auth Service CI
on:
push:
paths:
- 'services/auth-service/**'
- 'packages/**'
pull_request:
paths:
- 'services/auth-service/**'
- 'packages/**'
jobs:
lint-and-test:
runs-on: ubuntu-latest
# Use Neon test database if available, otherwise use PostgreSQL service
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Prisma Client
run: pnpm --filter @goodgo/auth-service prisma:generate
env:
# Use Neon test DB if available, otherwise fallback to local PostgreSQL
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL_TEST != '' && secrets.NEON_DATABASE_URL_TEST || 'postgresql://testuser:testpass@localhost:5432/test_db' }}
- name: Run migrations
run: pnpm --filter @goodgo/auth-service prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL_TEST != '' && secrets.NEON_DATABASE_URL_TEST || 'postgresql://testuser:testpass@localhost:5432/test_db' }}
- name: Lint
run: pnpm --filter @goodgo/auth-service lint
- name: Type check
run: pnpm --filter @goodgo/auth-service typecheck
- name: Build
run: pnpm --filter @goodgo/auth-service build
- name: Test
run: pnpm --filter @goodgo/auth-service test
env:
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL_TEST != '' && secrets.NEON_DATABASE_URL_TEST || 'postgresql://testuser:testpass@localhost:5432/test_db' }}

57
.github/workflows/ci-mobile.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Mobile Apps CI
on:
push:
paths:
- 'apps/app-*/**'
- 'packages/**'
pull_request:
paths:
- 'apps/app-*/**'
- 'packages/**'
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.0'
channel: 'stable'
- name: Install Flutter dependencies (Admin)
run: |
cd apps/app-admin
flutter pub get
- name: Install Flutter dependencies (Client)
run: |
cd apps/app-client
flutter pub get
- name: Analyze Flutter code (Admin)
run: |
cd apps/app-admin
flutter analyze
- name: Analyze Flutter code (Client)
run: |
cd apps/app-client
flutter analyze

49
.github/workflows/ci-web.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: Web Apps CI
on:
push:
paths:
- 'apps/web-*/**'
- 'packages/**'
pull_request:
paths:
- 'apps/web-*/**'
- 'packages/**'
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint Web Admin
run: pnpm --filter @goodgo/web-admin lint || echo "Skipped"
- name: Lint Web Client
run: pnpm --filter @goodgo/web-client lint || echo "Skipped"
- name: Type check Web Admin
run: pnpm --filter @goodgo/web-admin typecheck || echo "Skipped"
- name: Type check Web Client
run: pnpm --filter @goodgo/web-client typecheck || echo "Skipped"
- name: Build Web Admin
run: pnpm --filter @goodgo/web-admin build || echo "Skipped"
- name: Build Web Client
run: pnpm --filter @goodgo/web-client build || echo "Skipped"

58
.github/workflows/deploy-production.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: Deploy to Production
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run database migrations
run: |
cd services/auth-service
pnpm prisma generate
pnpm prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL_PRODUCTION }}
- name: Setup kubectl
uses: azure/setup-kubectl@v3
- name: Configure kubectl
run: |
echo "${{ secrets.KUBECONFIG_PRODUCTION }}" | base64 -d > kubeconfig
export KUBECONFIG=./kubeconfig
- name: Deploy Auth Service
run: |
export KUBECONFIG=./kubeconfig
kubectl apply -f deployments/production/kubernetes/auth-service.yaml
kubectl apply -f deployments/production/kubernetes/configmap.yaml
kubectl apply -f deployments/production/kubernetes/ingress.yaml
kubectl rollout status deployment/auth-service -n production
- name: Deploy Web App
run: |
export KUBECONFIG=./kubeconfig
kubectl apply -f deployments/production/kubernetes/web-app.yaml || echo "Web app deployment not configured"
kubectl rollout status deployment/web-app -n production || echo "Web app deployment not configured"

57
.github/workflows/deploy-staging.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Deploy to Staging
on:
push:
branches:
- develop
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run database migrations
run: |
cd services/auth-service
pnpm prisma generate
pnpm prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL_STAGING }}
- name: Setup kubectl
uses: azure/setup-kubectl@v3
- name: Configure kubectl
run: |
echo "${{ secrets.KUBECONFIG_STAGING }}" | base64 -d > kubeconfig
export KUBECONFIG=./kubeconfig
- name: Deploy Auth Service
run: |
export KUBECONFIG=./kubeconfig
kubectl apply -f deployments/staging/kubernetes/auth-service.yaml
kubectl apply -f deployments/staging/kubernetes/configmap.yaml
kubectl apply -f deployments/staging/kubernetes/ingress.yaml
kubectl rollout status deployment/auth-service -n staging
- name: Deploy Web App
run: |
export KUBECONFIG=./kubeconfig
kubectl apply -f deployments/staging/kubernetes/web-app.yaml || echo "Web app deployment not configured"
kubectl rollout status deployment/web-app -n staging || echo "Web app deployment not configured"

87
.github/workflows/docker-build.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
name: Docker Build
on:
push:
branches:
- main
- develop
paths:
- 'services/auth-service/**'
- 'apps/web-*/**'
workflow_dispatch:
jobs:
build-auth-service:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Auth Service
uses: docker/build-push-action@v5
with:
context: ./services/auth-service
push: true
tags: |
goodgo/auth-service:latest
goodgo/auth-service:${{ github.sha }}
cache-from: type=registry,ref=goodgo/auth-service:buildcache
cache-to: type=registry,ref=goodgo/auth-service:buildcache,mode=max
build-web-admin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Web Admin
uses: docker/build-push-action@v5
with:
context: ./apps/web-admin
push: true
tags: |
goodgo/web-admin:latest
goodgo/web-admin:${{ github.sha }}
cache-from: type=registry,ref=goodgo/web-admin:buildcache
cache-to: type=registry,ref=goodgo/web-admin:buildcache,mode=max
build-web-client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Web Client
uses: docker/build-push-action@v5
with:
context: ./apps/web-client
push: true
tags: |
goodgo/web-client:latest
goodgo/web-client:${{ github.sha }}
cache-from: type=registry,ref=goodgo/web-client:buildcache
cache-to: type=registry,ref=goodgo/web-client:buildcache,mode=max

34
.github/workflows/pr-checks.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: PR Checks
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint all
run: pnpm lint
- name: Type check all
run: pnpm typecheck
- name: Build all
run: pnpm build