ci: simplify to test-only workflows + Makefile deploy targets
GitHub Actions now only runs tests (free, cloud runners, no setup). Deployment is manual via `make deploy-finance` / `make deploy-all` which builds locally, imports into k3d, and applies with kubectl. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
85930ef40f
commit
8b1c816fa0
33
.github/workflows/auth-gateway.yml
vendored
33
.github/workflows/auth-gateway.yml
vendored
@ -7,31 +7,22 @@ on:
|
||||
- apps/auth/services/gateway/**
|
||||
- go.mod
|
||||
- go.sum
|
||||
|
||||
env:
|
||||
IMAGE: homelab/auth-gateway
|
||||
pull_request:
|
||||
paths:
|
||||
- apps/auth/services/gateway/**
|
||||
- go.mod
|
||||
- go.sum
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: self-hosted
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
-t ${{ env.IMAGE }}:${{ github.sha }} \
|
||||
-t ${{ env.IMAGE }}:latest \
|
||||
-f apps/auth/services/gateway/Dockerfile \
|
||||
.
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Import image into k3d
|
||||
run: k3d image import ${{ env.IMAGE }}:${{ github.sha }} -c homelab
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
kubectl set image deployment/gateway \
|
||||
gateway=${{ env.IMAGE }}:${{ github.sha }} \
|
||||
-n auth
|
||||
kubectl rollout status deployment/gateway -n auth --timeout=120s
|
||||
- name: Test
|
||||
run: go test ./apps/auth/services/gateway/...
|
||||
|
||||
33
.github/workflows/auth-users.yml
vendored
33
.github/workflows/auth-users.yml
vendored
@ -7,31 +7,22 @@ on:
|
||||
- apps/auth/services/users/**
|
||||
- go.mod
|
||||
- go.sum
|
||||
|
||||
env:
|
||||
IMAGE: homelab/auth-users
|
||||
pull_request:
|
||||
paths:
|
||||
- apps/auth/services/users/**
|
||||
- go.mod
|
||||
- go.sum
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: self-hosted
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
-t ${{ env.IMAGE }}:${{ github.sha }} \
|
||||
-t ${{ env.IMAGE }}:latest \
|
||||
-f apps/auth/services/users/Dockerfile \
|
||||
.
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Import image into k3d
|
||||
run: k3d image import ${{ env.IMAGE }}:${{ github.sha }} -c homelab
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
kubectl set image deployment/users \
|
||||
users=${{ env.IMAGE }}:${{ github.sha }} \
|
||||
-n auth
|
||||
kubectl rollout status deployment/users -n auth --timeout=120s
|
||||
- name: Test
|
||||
run: go test ./apps/auth/services/users/...
|
||||
|
||||
36
.github/workflows/finance-api.yml
vendored
36
.github/workflows/finance-api.yml
vendored
@ -7,34 +7,22 @@ on:
|
||||
- apps/finance/**
|
||||
- go.mod
|
||||
- go.sum
|
||||
|
||||
env:
|
||||
IMAGE: homelab/finance-api
|
||||
pull_request:
|
||||
paths:
|
||||
- apps/finance/**
|
||||
- go.mod
|
||||
- go.sum
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: self-hosted
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run tests
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Test
|
||||
run: go test ./apps/finance/services/api/main/...
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
-t ${{ env.IMAGE }}:${{ github.sha }} \
|
||||
-t ${{ env.IMAGE }}:latest \
|
||||
-f apps/finance/services/api/Dockerfile \
|
||||
.
|
||||
|
||||
- name: Import image into k3d
|
||||
run: k3d image import ${{ env.IMAGE }}:${{ github.sha }} -c homelab
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
kubectl set image deployment/api \
|
||||
api=${{ env.IMAGE }}:${{ github.sha }} \
|
||||
-n finance
|
||||
kubectl rollout status deployment/api -n finance --timeout=120s
|
||||
|
||||
20
Makefile
20
Makefile
@ -4,6 +4,7 @@ SHELL := /bin/zsh
|
||||
|
||||
K3D_SCRIPT := infrastructure/k3d/k3d.sh
|
||||
TERRAFORM := terraform
|
||||
SHA := $(shell git rev-parse --short HEAD)
|
||||
|
||||
.PHONY: up
|
||||
up: ## Create the k3d dev cluster
|
||||
@ -19,13 +20,28 @@ infra: ## Deploy shared infrastructure (MongoDB, monitoring, Traefik metrics)
|
||||
|
||||
SERVICES := $(shell find apps -name Makefile -path "*/services/*" -exec dirname {} \;)
|
||||
|
||||
.PHONY: deploy-finance
|
||||
deploy-finance: ## Build and deploy the finance API
|
||||
$(MAKE) -C apps/finance/services/api build-deploy IMAGE_TAG=$(SHA)
|
||||
|
||||
.PHONY: deploy-auth-users
|
||||
deploy-auth-users: ## Build and deploy the auth users service
|
||||
$(MAKE) -C apps/auth/services/users build-deploy IMAGE_TAG=$(SHA)
|
||||
|
||||
.PHONY: deploy-auth-gateway
|
||||
deploy-auth-gateway: ## Build and deploy the auth gateway service
|
||||
$(MAKE) -C apps/auth/services/gateway build-deploy IMAGE_TAG=$(SHA)
|
||||
|
||||
.PHONY: test
|
||||
test: ## Run all tests
|
||||
go test ./...
|
||||
|
||||
.PHONY: deploy-all
|
||||
deploy-all: ## Build, load, deploy, and restart every service
|
||||
@for dir in $(SERVICES); do \
|
||||
echo "\033[36m>>> $$dir\033[0m"; \
|
||||
$(MAKE) -C "$$dir" build-deploy || true; \
|
||||
$(MAKE) -C "$$dir" build-deploy IMAGE_TAG=$(SHA) || true; \
|
||||
done
|
||||
$(MAKE) restart-all
|
||||
|
||||
.PHONY: restart-all
|
||||
restart-all: ## Restart all deployments (pick up new images)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user