Skip to content

Added CI CD with Github actions, base CI CD #2

Added CI CD with Github actions, base CI CD

Added CI CD with Github actions, base CI CD #2

Workflow file for this run

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