Files
Edu/.github/workflows/ci-go.yml
SpecialX c31b3ddeba ci(infra): workflow 参照 CICD 参考项目重构
- 所有需要 docker 的 job 改用 container: dockerreg.eazygame.cn/node-with-docker:22

- ci-go.yml: quality 阶段用 golang:1.22-alpine,docker-build 阶段切到 node-with-docker:22

- ci-ts.yml/docker.yml/deploy.yml: 全部加 container 配置

- 移除 setup-node/setup-go action(容器内已有 node/go 或手动安装)

- 不配置 npm 代理(runner 已全局代理)
2026-07-08 16:12:07 +08:00

61 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: CI Go
# 参考实现E:\Desktop\CICD\.gitea\workflows\ci.yml
# Go 服务分两阶段:
# - quality: golang:1.22-alpine 容器(不需要 docker
# - docker-build: dockerreg.eazygame.cn/node-with-docker:22 + setup-go需要 docker 命令)
# 详见 docs/standards/cicd-runbook.md §10、project_rules §15.7
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
container: golang:1.22-alpine
defaults:
run:
working-directory: services/api-gateway
steps:
- uses: actions/checkout@v4
- 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
container: dockerreg.eazygame.cn/node-with-docker:22
needs: quality
steps:
- uses: actions/checkout@v4
- name: Build api-gateway
run: |
docker build \
-t edu/api-gateway:ci \
-f services/api-gateway/Dockerfile \
services/api-gateway