This commit is contained in:
2025-09-25 09:15:43 +08:00
parent 344093e3d9
commit fd73dd9373

View File

@@ -1,29 +0,0 @@
name: Go Test CI # 工作流的名称
on: [push] # 指定触发事件当发生推送push时运行
jobs:
test-with-alpine: # 定义一个名为 "test" 的任务
runs-on: ubuntu-latest
container: golang:alpine # 关键:使用 golang:alpine 容器作为运行环境
steps: # 定义任务执行的一系列步骤
- name: Checkout code # 步骤1获取代码
uses: https://gitea.com/actions/checkout@v3 # 使用官方action来检出你的代码仓库
- name: Install dependencies # 步骤2安装依赖
run: |
# 在 Alpine 中安装 Gitalpine 镜像默认不包含 git
apk add --no-cache git
- name: Download Go modules
run: |
go mod download
go mod verify
- name: Run Go Test
run: |
echo "Running tests using Go version:"
go version
echo "Test results:"
go test -v -race ./... # 添加 -race 标志进行竞态检测