diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..38eb3bd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: Go Test CI # 工作流的名称 + +on: [push] # 指定触发事件:当发生推送(push)时运行 + +jobs: + test: # 定义一个名为 "test" 的任务 + runs-on: ubuntu-latest # 指定任务运行在最新的Ubuntu环境中 + steps: # 定义任务执行的一系列步骤 + - name: Checkout code # 步骤1:获取代码 + uses: actions/checkout@v3 # 使用官方action来检出你的代码仓库 + + - name: Set up Go # 步骤2:设置Go环境 + uses: actions/setup-go@v3 # 使用官方action来安装指定版本的Go + with: + go-version: '1.25' # 指定Go版本,请根据你的项目需要修改 + + - name: Run Go Test # 步骤3:执行 go test + run: go test ./... # 运行当前项目下所有包的测试。你也可以使用 `go test -v ./...` 来获得更详细的输出 \ No newline at end of file