Skip to content

Commit

Permalink
Added CI CD with Github actions, base CI CD
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdluigi committed Dec 18, 2024
1 parent 0816aa6 commit ea6b08d
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CloudVault CI/CD

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test-backend:
name: Build & Test Backend
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.28

- name: Install Dependencies
run: go mod tidy

- name: Run Tests
run: go test ./... -v

build-and-test-frontend:
name: Build & Test Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install Dependencies
working-directory: ./frontend
run: npm install

- name: Run Tests
working-directory: ./frontend
run: npm run test

deploy:
name: Deploy to IBM Cloud
needs: [build-and-test-backend, build-and-test-frontend]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Authenticate with IBM Cloud
run: |
echo "${{ secrets.IBM_CLOUD_API_KEY }}" | ibmcloud login --apikey @-
- name: Configure Kubernetes Cluster
run: ibmcloud ks cluster config --cluster cloudvault-cluster

- name: Deploy Backend to Kubernetes
run: |
kubectl apply -f k8s/backend-deployment.yml
kubectl apply -f k8s/backend-service.yml
- name: Deploy Frontend to Kubernetes
run: |
kubectl apply -f k8s/frontend-deployment.yml
kubectl apply -f k8s/frontend-service.yml

0 comments on commit ea6b08d

Please sign in to comment.