forked from echocat/caddy-filter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
55 lines (49 loc) · 1.79 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
51
52
53
54
55
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.16'
}
group 'github.com/echocat/caddy-filter'
golang {
// For testing only the current platform is required.
platforms = currentPlatform()
dependencies {
build 'github.com/mholt/caddy:v0.10.10'
test 'github.com/stretchr/testify'
tool 'github.com/mattn/goveralls'
}
build {
useTemporaryGopath = true
}
testing {
coverProfile = "${buildDir}/testing/${name}.cover"
coverProfileHtml = "${buildDir}/testing/${name}.cover.html"
testArguments = ["-check.vv"]
}
toolchain {
goversion = 'go1.8'
}
}
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) {
logger.info("No COVERALLS_TOKEN provided. Will skip upload coverage report.")
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")