forked from luoliwoshang/codeagent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
62 lines (48 loc) · 955 Bytes
/
.travis.yml
File metadata and controls
62 lines (48 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
language: go
go:
- "1.21"
os:
- linux
dist: xenial
# 只对 Pull Request 进行检查
if: type = pull_request
# 缓存模块以加速构建
cache:
directories:
- $HOME/.cache/go-build
- $GOPATH/pkg/mod
# 环境变量
env:
- GO111MODULE=on
# 构建前的准备工作
before_install:
- go version
- echo $HOME
- echo $GOPATH
- echo $GOROOT
- which go
# 安装依赖
install:
- go mod download
- go mod verify
# 构建脚本
script:
# 1. 编译
- echo "Building project..."
- make build
# 2. 代码检查
- echo "Running go vet..."
- go vet ./...
# 3. 格式检查
- echo "Checking code format..."
- test -z "$(gofmt -l .)"
# 4. 单元测试
- echo "Running unit tests..."
- make test
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
# 构建成功后的操作
after_success:
- bash <(curl -s https://codecov.io/bash)
# 通知设置
notifications:
email: false