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

Refactor repository layout and convert build system to Mage.

This commit implements a massive refactor of the repository, and
moves the build system over to use Mage (magefile.org) which should
allow seamless building across multiple platforms.
This commit is contained in:
Will Rouesnel
2018-02-23 01:55:49 +11:00
parent 3e6cf08dc5
commit 989489096e
269 changed files with 35309 additions and 2017 deletions

View File

@@ -137,6 +137,32 @@ test:
For more information, See https://coveralls.zendesk.com/hc/en-us/articles/201342809-Go
## Sempahore
Store your Coveralls API token in `Environment Variables`:
```
COVERALLS_TOKEN=your_token_goes_here
```
More instructions on how to do this can be found in the [Semahore documentation](https://semaphoreci.com/docs/exporting-environment-variables.html).
Replace the `go test` line in your `Commands` with these lines:
```
$ go get github.com/mattn/goveralls
$ goveralls -service semaphore
```
`goveralls` automatically use the environment variable `COVERALLS_TOKEN` as the
default value for `-repotoken`.
You can use the `-v` flag to see verbose output from the test suite:
```
$ goveralls -v -service semaphore
```
# Authors
* Yasuhiro Matsumoto (a.k.a. mattn)

View File

@@ -54,6 +54,7 @@ var (
service = flag.String("service", "travis-ci", "The CI service or other environment in which the test suite was run. ")
shallow = flag.Bool("shallow", false, "Shallow coveralls internal server errors")
ignore = flag.String("ignore", "", "Comma separated files to ignore")
show = flag.Bool("show", false, "Show which package is being tested")
)
// usage supplants package flag's Usage variable
@@ -149,6 +150,9 @@ func getCoverage() ([]*SourceFile, error) {
args = append(args, line)
cmd.Args = args
if *show {
fmt.Println("goveralls:", line)
}
err = cmd.Run()
if err != nil {
return nil, fmt.Errorf("%v: %v", err, outBuf.String())
@@ -234,6 +238,8 @@ func process() error {
jobId = circleCiJobId
} else if appveyorJobId := os.Getenv("APPVEYOR_JOB_ID"); appveyorJobId != "" {
jobId = appveyorJobId
} else if semaphoreJobId := os.Getenv("SEMPAHORE_BUILD_NUMBER"); semaphoreJobId != "" {
jobId = semaphoreJobId
}
if *repotoken == "" {
@@ -250,6 +256,8 @@ func process() error {
pullRequest = regexp.MustCompile(`[0-9]+$`).FindString(prURL)
} else if prNumber := os.Getenv("APPVEYOR_PULL_REQUEST_NUMBER"); prNumber != "" {
pullRequest = prNumber
} else if prNumber := os.Getenv("PULL_REQUEST_NUMBER"); prNumber != "" {
pullRequest = prNumber
}
sourceFiles, err := getCoverage()