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/**
|
- apps/auth/services/gateway/**
|
||||||
- go.mod
|
- go.mod
|
||||||
- go.sum
|
- go.sum
|
||||||
|
pull_request:
|
||||||
env:
|
paths:
|
||||||
IMAGE: homelab/auth-gateway
|
- apps/auth/services/gateway/**
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
test:
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build image
|
- uses: actions/setup-go@v5
|
||||||
run: |
|
with:
|
||||||
docker build \
|
go-version-file: go.mod
|
||||||
-t ${{ env.IMAGE }}:${{ github.sha }} \
|
|
||||||
-t ${{ env.IMAGE }}:latest \
|
|
||||||
-f apps/auth/services/gateway/Dockerfile \
|
|
||||||
.
|
|
||||||
|
|
||||||
- name: Import image into k3d
|
- name: Test
|
||||||
run: k3d image import ${{ env.IMAGE }}:${{ github.sha }} -c homelab
|
run: go test ./apps/auth/services/gateway/...
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
run: |
|
|
||||||
kubectl set image deployment/gateway \
|
|
||||||
gateway=${{ env.IMAGE }}:${{ github.sha }} \
|
|
||||||
-n auth
|
|
||||||
kubectl rollout status deployment/gateway -n auth --timeout=120s
|
|
||||||
|
|||||||
33
.github/workflows/auth-users.yml
vendored
33
.github/workflows/auth-users.yml
vendored
@ -7,31 +7,22 @@ on:
|
|||||||
- apps/auth/services/users/**
|
- apps/auth/services/users/**
|
||||||
- go.mod
|
- go.mod
|
||||||
- go.sum
|
- go.sum
|
||||||
|
pull_request:
|
||||||
env:
|
paths:
|
||||||
IMAGE: homelab/auth-users
|
- apps/auth/services/users/**
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
test:
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build image
|
- uses: actions/setup-go@v5
|
||||||
run: |
|
with:
|
||||||
docker build \
|
go-version-file: go.mod
|
||||||
-t ${{ env.IMAGE }}:${{ github.sha }} \
|
|
||||||
-t ${{ env.IMAGE }}:latest \
|
|
||||||
-f apps/auth/services/users/Dockerfile \
|
|
||||||
.
|
|
||||||
|
|
||||||
- name: Import image into k3d
|
- name: Test
|
||||||
run: k3d image import ${{ env.IMAGE }}:${{ github.sha }} -c homelab
|
run: go test ./apps/auth/services/users/...
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
run: |
|
|
||||||
kubectl set image deployment/users \
|
|
||||||
users=${{ env.IMAGE }}:${{ github.sha }} \
|
|
||||||
-n auth
|
|
||||||
kubectl rollout status deployment/users -n auth --timeout=120s
|
|
||||||
|
|||||||
36
.github/workflows/finance-api.yml
vendored
36
.github/workflows/finance-api.yml
vendored
@ -7,34 +7,22 @@ on:
|
|||||||
- apps/finance/**
|
- apps/finance/**
|
||||||
- go.mod
|
- go.mod
|
||||||
- go.sum
|
- go.sum
|
||||||
|
pull_request:
|
||||||
env:
|
paths:
|
||||||
IMAGE: homelab/finance-api
|
- apps/finance/**
|
||||||
|
- go.mod
|
||||||
|
- go.sum
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
test:
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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/...
|
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
|
K3D_SCRIPT := infrastructure/k3d/k3d.sh
|
||||||
TERRAFORM := terraform
|
TERRAFORM := terraform
|
||||||
|
SHA := $(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
.PHONY: up
|
.PHONY: up
|
||||||
up: ## Create the k3d dev cluster
|
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 {} \;)
|
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
|
.PHONY: deploy-all
|
||||||
deploy-all: ## Build, load, deploy, and restart every service
|
deploy-all: ## Build, load, deploy, and restart every service
|
||||||
@for dir in $(SERVICES); do \
|
@for dir in $(SERVICES); do \
|
||||||
echo "\033[36m>>> $$dir\033[0m"; \
|
echo "\033[36m>>> $$dir\033[0m"; \
|
||||||
$(MAKE) -C "$$dir" build-deploy || true; \
|
$(MAKE) -C "$$dir" build-deploy IMAGE_TAG=$(SHA) || true; \
|
||||||
done
|
done
|
||||||
$(MAKE) restart-all
|
|
||||||
|
|
||||||
.PHONY: restart-all
|
.PHONY: restart-all
|
||||||
restart-all: ## Restart all deployments (pick up new images)
|
restart-all: ## Restart all deployments (pick up new images)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user