基于gin的web工程单元测试
可以使用jenkins做流水线来定时运行
请参考:https://www.jenkins.io/zh/doc/tutorials/build-a-java-app-with-maven/#fork-sample-repository
Fix the Jenkins error: Invalid agent type Docker specified [any, label, none]
解决方案:
在jenkins的插件管理中,安装Docker Pipeline
安装地址:http://localhost:8080/pluginManager/available
教学视频:https://www.youtube.com/watch?v=m5IFbG07V-c&t=1s
pipeline {
agent {
docker {
image 'golang:latest'
}
}
stages {
stage('Test') {
steps {
sh 'cd src;go test -coverprofile=../target/c.out;go tool cover -html=../target/c.out -o ../target/coverage.html;'
}
}
}
}
参考代码:Jenkinsfile

