Skip to content

Update README.md

Update README.md #55

Workflow file for this run

name: Thunder CI/CD Pipeline
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
test:
name: Run Tests and Generate Coverage
runs-on: ubuntu-latest
env:
JWT_SECRET: "testsecret"
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: thunder
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U testuser -d testdb"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install Dependencies
run: go mod tidy
- name: Generate SSL Certificates
run: |
mkdir -p certs
openssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt -days 365 -nodes \
-subj "/CN=localhost" \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
- name: Run Unit Tests
run: go test -v ./...
- name: Run Integration Tests (gRPC + REST)
run: go test -v ./backend/... ./db/...
- name: Generate Coverage Report
run: go test -coverprofile=coverage.txt ./backend/... ./db/...
- name: Print Coverage Summary
run: go tool cover -func=coverage.txt
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.txt
deploy:
name: Build and Deploy to Kubernetes
runs-on: ubuntu-latest
needs: test # Ensures tests pass before deployment
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Generate SSL Certificates
run: |
mkdir -p certs
openssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt -days 365 -nodes \
-subj "/CN=localhost" \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
- name: Log in to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: docker build -t raezil/app:latest .
- name: Push Docker Image
run: docker push raezil/app:latest
- name: Install and Start Minikube
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=docker
- name: Set Up Kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Deploy to Kubernetes
working-directory: ./k8s
run: |
kubectl apply -f postgres-deployment.yaml
kubectl apply -f postgres-service.yaml
kubectl apply -f pgbouncer-all.yaml
kubectl apply -f app-deployment.yaml
kubectl apply -f app-service.yaml