Nik Afiq 520f5d1ffb
Some checks failed
CI / build-ai-gateway (push) Has been cancelled
CI / build-ha-gateway (push) Has been cancelled
CI / build-discord-bot (push) Has been cancelled
CI / test (push) Has been cancelled
feat: add ai-gateway microservice with gRPC API for AI logic
- Implemented new gRPC service `AIService` in `proto/ai/v1/ai.proto` for handling natural language queries.
- Generated Go code for the gRPC service and messages in `gen/ai/v1/`.
- Created `services/ai-gateway/` directory structure with necessary files for the service.
- Added configuration loading and structured logging.
- Implemented domain logic for intent parsing and interaction with Home Assistant.
- Established outbound adapters for Ollama and Home Assistant with mTLS support.
- Updated `go.work` to include the new service and maintain existing dependencies.
- Modified `discord-bot` to use the new `ai-gateway` for AI interactions.
- Added deployment manifest for Kubernetes and CI/CD configuration for building and deploying the service.
2026-04-21 21:52:28 +09:00

124 lines
3.1 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: gitea.nik4nao.com
IMAGE_PREFIX: gitea.nik4nao.com/nik
GOPATH: /tmp/go
GOMODCACHE: /tmp/go/pkg/mod
GOCACHE: /tmp/go-build
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: prepare go cache dirs
run: mkdir -p "$GOMODCACHE" "$GOCACHE"
- uses: actions/setup-go@v6
with:
go-version-file: go.work
cache-dependency-path: |
go.work.sum
ai-gateway/go.sum
ha-gateway/go.sum
discord-bot/go.sum
gen/go.sum
- name: go vet
run: |
cd gen && go vet ./...
cd ../ai-gateway && go vet ./...
cd ../ha-gateway && go vet ./...
cd ../discord-bot && go vet ./...
- name: go test
run: |
cd gen && go test ./...
cd ../ai-gateway && go test ./...
cd ../ha-gateway && go test ./...
cd ../discord-bot && go test ./...
build-ai-gateway:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- uses: docker/build-push-action@v7
with:
context: .
file: ai-gateway/Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_PREFIX }}/ai-gateway:${{ github.sha }}
${{ env.IMAGE_PREFIX }}/ai-gateway:latest
build-ha-gateway:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- uses: docker/build-push-action@v7
with:
context: .
file: ha-gateway/Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_PREFIX }}/ha-gateway:${{ github.sha }}
${{ env.IMAGE_PREFIX }}/ha-gateway:latest
build-discord-bot:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- uses: docker/build-push-action@v7
with:
context: .
file: discord-bot/Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_PREFIX }}/discord-bot:${{ github.sha }}
${{ env.IMAGE_PREFIX }}/discord-bot:latest