u
This commit is contained in:
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
@@ -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 中安装 Git(alpine 镜像默认不包含 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 标志进行竞态检测
|
||||
Reference in New Issue
Block a user