Skip to content

Commit e9b125b

Browse files
committed
Add GitHub Actions CI/CD pipelines
1 parent 07d9331 commit e9b125b

3 files changed

Lines changed: 162 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: "1.24"
20+
21+
- name: Download dependencies
22+
run: go mod download
23+
24+
- name: Verify dependencies
25+
run: go mod verify
26+
27+
- name: Build
28+
run: go build -v ./...
29+
30+
- name: Run go vet
31+
run: go vet ./...
32+
33+
- name: Run tests
34+
run: go test -v -race -coverprofile=coverage.out ./...
35+
36+
- name: Upload coverage
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: coverage
40+
path: coverage.out
41+
42+
lint:
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Set up Go
49+
uses: actions/setup-go@v5
50+
with:
51+
go-version: "1.24"
52+
53+
- name: Run golangci-lint
54+
uses: golangci/golangci-lint-action@v4
55+
with:
56+
version: latest
57+
58+
docker:
59+
runs-on: ubuntu-latest
60+
needs: [build, lint]
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Build Docker image
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
push: false
73+
tags: minipaas:${{ github.sha }}
74+
cache-from: type=gha
75+
cache-to: type=gha,mode=max

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
packages: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: "1.24"
28+
29+
- name: Run tests
30+
run: go test -v ./...
31+
32+
- name: Build binaries
33+
run: |
34+
GOOS=linux GOARCH=amd64 go build -o dist/minipaas-linux-amd64 ./cmd/server
35+
GOOS=linux GOARCH=arm64 go build -o dist/minipaas-linux-arm64 ./cmd/server
36+
GOOS=darwin GOARCH=amd64 go build -o dist/minipaas-darwin-amd64 ./cmd/server
37+
GOOS=darwin GOARCH=arm64 go build -o dist/minipaas-darwin-arm64 ./cmd/server
38+
GOOS=windows GOARCH=amd64 go build -o dist/minipaas-windows-amd64.exe ./cmd/server
39+
40+
- name: Log in to Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Extract metadata
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
53+
- name: Build and push Docker image
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: .
57+
push: true
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
61+
- name: Create Release
62+
uses: softprops/action-gh-release@v1
63+
with:
64+
files: dist/*
65+
generate_release_notes: true

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![Go](https://img.shields.io/badge/Go-1.24-00ADD8?logo=go&logoColor=white)
44
![Kubernetes](https://img.shields.io/badge/Kubernetes-1.29+-326CE5?logo=kubernetes&logoColor=white)
55
![License](https://img.shields.io/badge/License-MIT-green)
6-
![Build](https://img.shields.io/badge/Build-Passing-brightgreen)
6+
![Build](https://github.com/Demiserular/MINIPASSS/actions/workflows/ci.yml/badge.svg)
77

88
A lightweight Platform-as-a-Service control plane I built to explore how services like Heroku and Cloud Run work under the hood. This isn't a toy project—it handles real Kubernetes deployments with proper revision tracking, rolling updates, and horizontal scaling.
99

@@ -161,6 +161,27 @@ Some things I'd add with more time:
161161
- Resource quota enforcement at the app level
162162
- Prometheus metrics for observability
163163

164+
## CI/CD
165+
166+
The project includes GitHub Actions workflows:
167+
168+
- **CI Pipeline** (`ci.yml`) - Runs on every push/PR:
169+
- Build and test
170+
- Race condition detection
171+
- Code linting with golangci-lint
172+
- Docker image build verification
173+
174+
- **Release Pipeline** (`release.yml`) - Triggered on version tags:
175+
- Cross-platform binary builds (Linux, macOS, Windows)
176+
- Docker image pushed to GitHub Container Registry
177+
- Automatic GitHub release with binaries
178+
179+
```bash
180+
# Create a release
181+
git tag v1.0.0
182+
git push origin v1.0.0
183+
```
184+
164185
## License
165186

166187
MIT—use it however you want.

0 commit comments

Comments
 (0)