1 parent a4a9e3d commit 759478dCopy full SHA for 759478d
1 file changed
.github/workflows/go.yml
@@ -0,0 +1,36 @@
1
+name: Go CI Build and Test
2
+
3
+# 触发工作流的事件
4
+on:
5
+ push:
6
+ branches: [ "main" ]
7
+ pull_request:
8
9
+ workflow_dispatch: # 允许手动触发
10
11
+jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
17
+ - name: Set up Go
18
+ uses: actions/setup-go@v5
19
+ with:
20
+ # 确保 Go 版本与您的 go.mod 兼容
21
+ go-version: '1.22'
22
23
+ - name: Build and Test goj-backend module
24
+ # Go CI 脚本的关键,进入子目录操作
25
+ run: |
26
+ # 导航到 goj-backend 目录
27
+ cd goj-backend/
28
29
+ # 下载所有依赖项
30
+ go mod tidy
31
32
+ # 运行所有测试(如果存在测试文件)
33
+ go test -v ./...
34
35
+ # 尝试编译整个模块,确保没有编译错误
36
+ go build -v ./...
0 commit comments