所以我有一个go-gettable依赖项,测试等项目.
我想把它整合到Jenkins中.除了编写makefile之外,是否存在任何人为此用例推荐的自动构建系统?
我需要:
我过去曾经使用过godag来做这类工作,但似乎有点没有维护.
编辑:目前我正在使用以下脚本直接输入Jenkins作为构建步骤:
#this gets the dependencies but doesn't install them, avoiding permission problems
go get -d
#build the packages, -x outputs the compiler command line
go build -x
#this was tricky - ./... means "for each sub-package recursively"
go test ./...
Run Code Online (Sandbox Code Playgroud)
小智 7
您也可以使用teamcity来完成.
以下是构建地形的示例.
Teamcity代理设置:
Teamcity构建设置:
使用checkout规则(我们想使用golang约定):
+ :. => src/github.com/mitchellh/terraform
构建步骤:
echo cd %system.teamcity.build.checkoutDir%
cd "%system.teamcity.build.checkoutDir%"
path=C:\Program Files (x86)\Git\bin;%env.Path%;%system.teamcity.build.checkoutDir%\bin;
echo path=C:\Program Files (x86)\Git\bin;%env.Path%;%system.teamcity.build.checkoutDir%\bin;
set GOPATH=%system.teamcity.build.checkoutDir%
echo set GOPATH=%system.teamcity.build.checkoutDir%
echo "Getting dependancies"
go get golang.org/x/tools/cmd/vet
go get golang.org/x/tools/cmd/cover
go get golang.org/x/tools/cmd/stringer
go get github.com/mitchellh/gox
echo cd %system.teamcity.build.checkoutDir%\src\github.com\mitchellh\terraform
cd "%system.teamcity.build.checkoutDir%\src\github.com\mitchellh\terraform"
echo "Update resources"
go get ./...
echo "Run static code analysis"
go tool vet -asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr .
echo "Build"
cd scripts
sh build.sh
echo "Run unit tests"
go test -timeout=30s -parallel=4
echo "Run code coverage"
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
rm coverage.out
Run Code Online (Sandbox Code Playgroud)
小智 2
我在 Mac 上使用 Team City 构建服务器来运行 rake 文件,在 rake 文件中,我执行所有命令来获取依赖项、(go gets)、测试并构建到正确的环境。
如果您需要有关编写 Rake 文件的任何指导,请告诉我,
附带说明一下,我一直在使用这个框架为 REST Api 创建功能测试。这已经多次保存了我的代码。http://github.com/DigitalInnovation/cucumber_rest_api
| 归档时间: |
|
| 查看次数: |
6437 次 |
| 最近记录: |