Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 32 additions & 43 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ on:
branches: [main, develop]

env:
NODE_VERSION: '18.x'
NODE_VERSION: '20.x'
POSTGRES_VERSION: '14'

defaults:
run:
working-directory: microservices/config-service

jobs:
# Code Quality Checks
lint-and-format:
Expand All @@ -25,6 +29,7 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: 📋 Install dependencies
run: npm ci
Expand Down Expand Up @@ -52,9 +57,13 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: 📋 Install dependencies
run: npm ci

- name: 🔐 Run security audit
run: npm audit --audit-level=moderate
run: npm audit --omit=dev --audit-level=moderate

- name: 🛡️ Run dependency vulnerability scan
run: |
Expand All @@ -68,7 +77,7 @@ jobs:

strategy:
matrix:
node-version: ['16.x', '18.x', '20.x']
node-version: ['20.x', '22.x']

steps:
- name: 📥 Checkout code
Expand All @@ -79,6 +88,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: 📋 Install dependencies
run: npm ci
Expand Down Expand Up @@ -137,31 +147,21 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: 📋 Install dependencies
run: npm ci

- name: 🗄️ Run database migrations
run: npm run migration:run
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test_user
DATABASE_PASSWORD: test_password
DATABASE_NAME: quest_service_test

- name: 🔗 Run integration tests
run: npm run test:integration
run: npm run test:e2e -- --runInBand
env:
NODE_ENV: test
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test_user
DATABASE_PASSWORD: test_password
DATABASE_NAME: quest_service_test
REDIS_HOST: localhost
REDIS_PORT: 6379
JWT_SECRET: test-jwt-secret-key-for-ci
DB_HOST: localhost
DB_PORT: 5432
DB_USER: test_user
DB_PASSWORD: test_password
DB_NAME: quest_service_test
ENCRYPTION_KEY: test-encryption-key-at-least-32-characters

- name: 📊 Upload integration test coverage
uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -209,39 +209,27 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: 📋 Install dependencies
run: npm ci

- name: 🏗️ Build application
run: npm run build

- name: 🗄️ Setup test database
run: |
npm run migration:run
npm run seed:run
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test_user
DATABASE_PASSWORD: test_password
DATABASE_NAME: quest_service_e2e

- name: 🎭 Run E2E tests
run: npm run test:e2e
run: npm run test:e2e -- --runInBand
env:
NODE_ENV: test
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test_user
DATABASE_PASSWORD: test_password
DATABASE_NAME: quest_service_e2e
REDIS_HOST: localhost
REDIS_PORT: 6379
JWT_SECRET: test-jwt-secret-key-for-e2e
DB_HOST: localhost
DB_PORT: 5432
DB_USER: test_user
DB_PASSWORD: test_password
DB_NAME: quest_service_e2e
ENCRYPTION_KEY: test-encryption-key-at-least-32-characters

- name: 📸 Upload E2E test artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-test-results
Expand Down Expand Up @@ -280,6 +268,7 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: 📋 Install dependencies
run: npm ci
Expand Down Expand Up @@ -343,7 +332,7 @@ jobs:
- name: 🏗️ Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
context: microservices/config-service
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: microservices/config-service

steps:
- name: Checkout Code
Expand All @@ -19,6 +22,7 @@ jobs:
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: microservices/config-service/package-lock.json

- name: Install Dependencies
run: npm ci
Expand All @@ -30,7 +34,7 @@ jobs:
run: npm run format:check

- name: TypeScript Type Check
run: npm run typecheck
run: npm run type-check

- name: Run Unit Tests
run: npm test
Expand Down
Loading
Loading