feat: CI/CD #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD with Minikube and Helm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Install Kubectl | |
uses: azure/setup-kubectl@v3 | |
with: | |
version: 'latest' | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: 'latest' | |
- name: Set up Minikube | |
uses: medyagh/setup-minikube@latest | |
with: | |
minikube version: 'latest' | |
driver: docker | |
- name: Start Minikube | |
run: | | |
minikube start --driver=docker | |
minikube status | |
minikube kubectl -- get nodes | |
- name: Verify Minikube Status | |
run: minikube status | |
- name: Verify kubectl Configuration | |
run: | | |
kubectl config view | |
kubectl config get-contexts | |
kubectl config use-context minikube || echo "No Minikube context found" | |
kubectl config current-context | |
kubectl cluster-info | |
kubectl get nodes | |
- name: Wait for Minikube to Be Ready | |
run: sleep 30 | |
- name: Export Minikube environment variables | |
run: | | |
eval $(minikube -p minikube docker-env) | |
echo "Minikube Docker environment configured" | |
deploy: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Verify Minikube and Kubernetes Connection | |
run: | | |
minikube start | |
kubectl config use-context minikube || echo "No Minikube context found" | |
kubectl cluster-info | |
kubectl get nodes | |
- name: Install cert-manager | |
run: | | |
kubectl apply --validate=false -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.5/cert-manager.crds.yaml | |
helm repo add jetstack https://charts.jetstack.io | |
helm repo update | |
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.12.5 | |
kubectl wait --namespace cert-manager --for=condition=available deployment/cert-manager --timeout=120s | |
- name: Deploy with Helm | |
run: | | |
helm upgrade --install demo ./k8s --wait | |
helm list | |
- name: Run Tests | |
run: | | |
minikube addons enable ingress | |
kubectl get all | |
kubectl get ingress |