- ci-ts.yml: lint/typecheck/test/build + arch-scan + docker-build(classes + teacher-portal) - ci-go.yml: vet/build/test + docker-build(api-gateway) - ci-proto.yml: buf lint + buf breaking(本地 .git 比较) - docker.yml: main/tag 触发,构建推送 3 服务镜像到 Gitea Registry - deploy.yml: workflow_dispatch + workflow_run 触发,Runner 直接 docker compose 部署,含健康检查与回滚 - 所有 workflow runs-on: ubuntu-latest 匹配 actrunner 标签
57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
name: CI Go
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'services/api-gateway/**'
|
|
- 'services/push-gateway/**'
|
|
- 'packages/shared-go/**'
|
|
- 'go.work'
|
|
- '.github/workflows/ci-go.yml'
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- 'services/api-gateway/**'
|
|
- 'services/push-gateway/**'
|
|
- 'packages/shared-go/**'
|
|
- 'go.work'
|
|
- '.github/workflows/ci-go.yml'
|
|
|
|
jobs:
|
|
quality:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: services/api-gateway
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
cache-dependency-path: services/api-gateway/go.sum
|
|
- name: Download deps
|
|
run: go mod download
|
|
- name: Vet
|
|
run: go vet ./...
|
|
- name: Build
|
|
run: go build ./...
|
|
- name: Test
|
|
run: go test ./... -v -coverprofile=coverage.out
|
|
|
|
docker-build:
|
|
runs-on: ubuntu-latest
|
|
needs: quality
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Build api-gateway
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./services/api-gateway
|
|
file: services/api-gateway/Dockerfile
|
|
push: false
|
|
tags: edu/api-gateway:ci
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|