A 层搬运(整包,源=poc-final 5e09a4cc): 协议四栈/pkg 标准件 12 包/util 计费纯函数/middleware/迁移链 repository·mysql v1~v19+clickhouse/model·entity/config/service·audit·balance/app/cmd·{migrate,reconcile,cmppbench}/tools·gen-dict/_bench/test·integration/openapi·yaml/监控三件/运维资产(compose+kind+CI 两套+Makefile+runbook)/scripts 种子/前端基建(根配置+src 基建目录,views 留 B 层)
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# go-sms CI(Gitea Actions,语法兼容 GitHub Actions)(Day 4)
|
||||
# 与 .gitlab-ci.yml 同语义:test → build → deploy-dev。
|
||||
# 需 Gitea 服务端启用 Actions 并注册 Runner;未启用时本文件不会执行,不影响仓库。
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
SERVICE: gateway
|
||||
GOPROXY: https://goproxy.cn,direct
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: Vet & Test
|
||||
run: |
|
||||
go vet ./...
|
||||
go test -race -cover ./...
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build image
|
||||
run: |
|
||||
SHA=${GITHUB_SHA::7}
|
||||
docker build --build-arg SERVICE=${SERVICE} --build-arg VERSION=${SHA} \
|
||||
--build-arg GOPROXY=${GOPROXY} -t go-sms-${SERVICE}:${SHA} .
|
||||
# 推送镜像仓库(配置 secrets 后取消注释)
|
||||
# - name: Push image
|
||||
# run: |
|
||||
# echo "${{ secrets.REGISTRY_PASS }}" | docker login ${{ secrets.REGISTRY }} -u ${{ secrets.REGISTRY_USER }} --password-stdin
|
||||
# docker push ${{ secrets.REGISTRY }}/go-sms/go-sms-${SERVICE}:${GITHUB_SHA::7}
|
||||
|
||||
deploy-dev:
|
||||
runs-on: [self-hosted, dev-kind] # 需要 kind Dev 集群所在的 self-hosted Runner
|
||||
needs: build
|
||||
steps:
|
||||
- name: Load & Rollout
|
||||
run: |
|
||||
SHA=${GITHUB_SHA::7}
|
||||
kind load docker-image go-sms-${SERVICE}:${SHA} --name go-sms-dev
|
||||
kubectl -n go-sms-dev set image deployment/go-sms-${SERVICE} ${SERVICE}=go-sms-${SERVICE}:${SHA}
|
||||
kubectl -n go-sms-dev rollout status deployment/go-sms-${SERVICE} --timeout=180s
|
||||
Reference in New Issue
Block a user