Files
Add-API/.gitea/workflows/main.yml
zomborip d288968854
Some checks failed
CI Pipeline for the Go API / Go Vet (basic static check) (push) Successful in 7s
CI Pipeline for the Go API / Docker Image Build Test (push) Successful in 15s
CI Pipeline for the Go API / Kubernetes Smoke Test (push) Successful in 5s
CI Pipeline for the Go API / Go Build & Cross-Compile (push) Successful in 14s
CI Pipeline for the Go API / Kubernetes Deployment (push) Has been cancelled
CD Update
2025-10-05 19:49:05 +02:00

109 lines
2.5 KiB
YAML

name: CI Pipeline for the Go API
on:
push:
branches:
- master
jobs:
docker-test:
name: Docker Image Build Test
runs-on: docker-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Docker image
run: |
docker build -t go-api-test .
go-test:
name: Go Vet (basic static check)
runs-on: docker-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check Go version
run: go version
- name: Go Vet (basic static check)
run: go vet ./...
go-build:
name: Go Build & Cross-Compile
runs-on: docker-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check Go version
run: go version
- name: Build Linux binary
run: |
mkdir -p build
go build -o build/go-api-linux main.go
- name: Build Windows binary
run: |
GOOS=windows GOARCH=amd64 go build -o build/go-api.exe main.go
- name: Show build output
run: ls -lh build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: go-api-binaries
path: build/
k8s-some-test:
name: Kubernetes Smoke Test
runs-on: docker-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure kubeconfig
run: |
mkdir -p ~/.kube
echo "$KUBECONFIG_GITEA" > ~/.kube/config
chmod 600 ~/.kube/config
env:
KUBECONFIG_GITEA: ${{ secrets.KUBECONFIG_GITEA }}
- name: Kubectl test
run: kubectl version --client
- name: K3S Cluster Connection Test
run: kubectl get nodes -o wide
k8s-deploy:
name: Kubernetes Deployment
runs-on: docker-latest
needs: [go-build, k8s-some-test]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure kubeconfig
run: |
mkdir -p ~/.kube
echo "$KUBECONFIG_GITEA" > ~/.kube/config
chmod 600 ~/.kube/config
env:
KUBECONFIG_GITEA: ${{ secrets.KUBECONFIG_GITEA }}
- name: Verify connection
run: kubectl get nodes -o wide
- name: Apply Deployment to Cluster
run: kubectl apply -f k8s/service.yaml
- name: Apply Service to Cluster
run: kubectl apply -f k8s/deployment.yaml
- name: Verify rollout
run: kubectl rollout status deployment/go-api