Skip to content

Commit

Permalink
added cd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aliakkas006 committed Apr 29, 2024
1 parent 8d865b1 commit 7f178bd
Show file tree
Hide file tree
Showing 16 changed files with 8,045 additions and 48 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Build, Test and Push Docker Image

on:
push:
branches:
- main

jobs:
# run-tests:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '21'

# - name: Test appointment service
# run: |
# cd services/appointment
# yarn install --frozen-lockfile
# yarn test

# - name: Test user service
# run: |
# cd services/user
# yarn install --frozen-lockfile
# yarn test

# - name: Test auth service
# run: |
# cd services/auth
# yarn install --frozen-lockfile
# yarn test

# - name: Test email service
# run: |
# cd services/email
# yarn install --frozen-lockfile
# yarn test

build-and-push:
# needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Qemu
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push api-gateway
uses: docker/build-push-action@v5
with:
context: ./api-gateway
file: ./api-gateway/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/api-gateway:latest

- name: Build and push appointment service
uses: docker/build-push-action@v5
with:
context: ./services/appointment
file: ./services/appointment/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/appointment:latest

- name: Build and push user service
uses: docker/build-push-action@v5
with:
context: ./services/user
file: ./services/user/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/user:latest

- name: Build and push auth service
uses: docker/build-push-action@v5
with:
context: ./services/auth
file: ./services/auth/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/auth:latest

- name: Build and push email service
uses: docker/build-push-action@v5
with:
context: ./services/email
file: ./services/email/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/email:latest
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Healthcare-Appointment-Scheduling-System/
## Setup
follow .env.example file for setup environment variables

### Run the `Docker Container`
### Run the `Microservices Dependency`
```bash
docker-compose up
```
Expand Down
14 changes: 14 additions & 0 deletions services/appointment/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
verbose: true,
forceExit: true,
clearMocks: true,
resetMocks: true,
restoreMocks: true,
};

export default config;
4 changes: 4 additions & 0 deletions services/appointment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "MIT",
"scripts": {
"dev": "ts-node-dev -r tsconfig-paths/register ./src/index.ts",
"test": "npx jest",
"build": "tsc && tsc-alias",
"migrate:dev": "prisma migrate dev",
"migrate:prod": "prisma migrate deploy"
Expand All @@ -24,9 +25,12 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/ioredis": "^5.0.0",
"@types/jest": "^29.5.12",
"@types/morgan": "^1.9.9",
"@types/node": "^20.12.6",
"jest": "^29.7.0",
"prisma": "^5.12.1",
"ts-jest": "^29.1.2",
"ts-node-dev": "^2.0.0",
"tsc": "^2.0.4",
"tsc-alias": "^1.8.8",
Expand Down
Empty file.
Loading

0 comments on commit 7f178bd

Please sign in to comment.