Skip to content

Commit 27b3857

Browse files
committed
* Added automated build scripts
1 parent b604ca3 commit 27b3857

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[![Go Report Card](https://goreportcard.com/badge/github.com/echocat/caddy-filter)](https://goreportcard.com/report/github.com/echocat/caddy-filter)
2+
[![Coverage Status](https://img.shields.io/coveralls/echocat/caddy-filter/master.svg?style=flat-square)](https://coveralls.io/github/echocat/caddy-filter?branch=master)
3+
[![License](https://img.shields.io/github/license/echocat/caddy-filter.svg?style=flat-square)](LICENSE)
24

35
# caddy-filter
46

build.gradle

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import org.echocat.gradle.plugins.golang.tasks.GolangTask
2+
import org.echocat.gradle.plugins.golang.utils.Executor
3+
import static org.echocat.gradle.plugins.golang.model.Platform.currentPlatform
4+
15
plugins {
26
id 'org.echocat.golang' version '0.1.11'
37
}
@@ -6,10 +10,11 @@ group 'github.com/echocat/caddy-filter'
610

711
golang {
812
// For testing only the current platform is required.
9-
platforms = org.echocat.gradle.plugins.golang.model.Platform.currentPlatform()
13+
platforms = currentPlatform()
1014
dependencies {
1115
build 'github.com/mholt/caddy'
1216
test 'github.com/stretchr/testify'
17+
tool 'github.com/mattn/goveralls'
1318
}
1419
build {
1520
useTemporaryGopath = true
@@ -20,8 +25,25 @@ golang {
2025
}
2126
}
2227

23-
task baseBuild(type: org.echocat.gradle.plugins.golang.tasks.GolangTask, overwrite: true) {
28+
task baseBuild(type: GolangTask, overwrite: true) {
2429
action {
2530
throw new UnsupportedOperationException("This project only supports test task.");
2631
}
2732
}
33+
34+
task uploadCoverage(type: GolangTask, group: "verification", description: "Upload test coverage report to coveralls.io.", dependsOn: "baseTest") {
35+
action {
36+
final token = System.getenv("COVERALLS_TOKEN")
37+
if (!token) {
38+
getState().skipped("NO-TOKEN-PROVIDED");
39+
return
40+
}
41+
Executor.executor("${project.buildDir}/tools/github.com/mattn/goveralls${build.currentPlatformExtension}", logger)
42+
.argument("-coverprofile=${project.buildDir}/testing/${project.name}.cover")
43+
.argument("-service=circle-ci")
44+
.argument("-repotoken=${token}")
45+
.execute()
46+
}
47+
}
48+
49+
test.dependsOn("uploadCoverage")

circle.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
general:
2+
artifacts:
3+
- build/testing
4+
5+
dependencies:
6+
override:
7+
- rm -f ~/.gitconfig
8+
cache_directories:
9+
- .gradle
10+
- ~/.m2/repository
11+
- ~/.gradle
12+
- ~/.go
13+
14+
test:
15+
override:
16+
- ./gradlew --stacktrace test

0 commit comments

Comments
 (0)