-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
50 lines (44 loc) · 1.62 KB
/
build.gradle
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
import org.echocat.gradle.plugins.golang.tasks.GolangTask
import org.echocat.gradle.plugins.golang.utils.Executor
import static org.echocat.gradle.plugins.golang.model.Platform.currentPlatform
plugins {
id 'org.echocat.golang' version '0.1.11'
}
group 'github.com/echocat/gocheck-addons'
golang {
// For testing only the current platform is required.
platforms = currentPlatform()
dependencies {
build 'gopkg.in/check.v1'
tool 'github.com/mattn/goveralls'
}
build {
useTemporaryGopath = true
}
testing {
coverProfile = "${buildDir}/testing/${name}.cover"
coverProfileHtml = "${buildDir}/testing/${name}.cover.html"
}
}
task baseBuild(type: GolangTask, overwrite: true) {
action {
throw new UnsupportedOperationException("This project only supports test task.");
}
}
task uploadCoverage(type: GolangTask, group: "verification", description: "Upload test coverage report to coveralls.io.", dependsOn: "baseTest") {
action {
final token = System.getenv("COVERALLS_TOKEN")
if (!token) {
getState().skipped("NO-TOKEN-PROVIDED");
return
}
Executor.executor("${project.buildDir}/tools/github.com/mattn/goveralls${build.currentPlatformExtension}", logger)
.argument("-coverprofile=${project.buildDir}/testing/${project.name}.cover")
.argument("-service=circle-ci")
.argument("-repotoken=${token}")
.env("GOROOT", toolchain.goroot)
.env("GOPATH", build.gopath)
.execute()
}
}
test.dependsOn("uploadCoverage")