1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-08 04:42:07 +03:00

Add cross-compilation Makefile targets and tar-based releases.

Revamp the build system to be more inline with other Prometheus exporters.
Notably add Darwin and Windows build targets, and add support for releases
using tar files.
This commit is contained in:
Will Rouesnel
2017-11-30 03:15:53 +11:00
parent 61b93a17a6
commit 5b9fea01ee
98 changed files with 10599 additions and 1487 deletions

View File

@@ -40,7 +40,7 @@ Enable Travis-CI on your github repository settings.
For a **public** github repository put below's `.travis.yml`.
```
```yml
language: go
sudo: false
go:
@@ -48,14 +48,14 @@ go:
before_install:
- go get github.com/mattn/goveralls
script:
- $HOME/gopath/bin/goveralls -service=travis-ci
- $GOPATH/bin/goveralls -service=travis-ci
```
For a **public** github repository, it is not necessary to define your repository key (`COVERALLS_TOKEN`).
For a **private** github repository put below's `.travis.yml`. If you use **travis pro**, you need to specify `-service=travis-pro` instead of `-service=travis-ci`.
```
```yml
language: go
sudo: false
go:
@@ -63,7 +63,7 @@ go:
before_install:
- go get github.com/mattn/goveralls
script:
- $HOME/gopath/bin/goveralls -service=travis-pro
- $GOPATH/bin/goveralls -service=travis-pro
```
Store your Coveralls API token in `Environment variables`.
@@ -81,7 +81,7 @@ $ travis encrypt COVERALLS_TOKEN=your_token_goes_here --add env.global
travis will add `env` block as following example:
```
```yml
env:
global:
secure: xxxxxxxxxxxxx

View File

@@ -48,14 +48,13 @@ func mergeProfs(pfss [][]*cover.Profile) []*cover.Profile {
ret := make([]*cover.Profile, 0, len(head))
for i, profile := range head {
for _, ps := range rest {
// find profiles
if len(ps) == 0 {
// no test files
continue
} else if len(ps) < i+1 {
log.Fatal("Profile length is different")
}
if ps[i].FileName != profile.FileName {
log.Fatal("Profile FileName is different")
continue
} else if ps[i].FileName != profile.FileName {
continue
}
profile.Blocks = mergeProfBlocks(profile.Blocks, ps[i].Blocks)
}

View File

@@ -45,6 +45,7 @@ var (
extraFlags Flags
pkg = flag.String("package", "", "Go package")
verbose = flag.Bool("v", false, "Pass '-v' argument to 'go test' and output to stdout")
race = flag.Bool("race", false, "Pass '-race' argument to 'go test'")
debug = flag.Bool("debug", false, "Enable debug output")
coverprof = flag.String("coverprofile", "", "If supplied, use a go cover profile (comma separated)")
covermode = flag.String("covermode", "count", "sent as covermode argument to go test")
@@ -132,12 +133,18 @@ func getCoverage() ([]*SourceFile, error) {
outBuf := new(bytes.Buffer)
cmd.Stdout = outBuf
cmd.Stderr = outBuf
args := []string{"go", "test", "-covermode", *covermode, "-coverprofile", f.Name(), coverpkg}
coverm := *covermode
if *race {
coverm = "atomic"
}
args := []string{"go", "test", "-covermode", coverm, "-coverprofile", f.Name(), coverpkg}
if *verbose {
args = append(args, "-v")
cmd.Stdout = os.Stdout
}
if *race {
args = append(args, "-race")
}
args = append(args, extraFlags...)
args = append(args, line)
cmd.Args = args