cleanup ci
This commit is contained in:
parent
d5533157a3
commit
cca8a0a88c
18
.drone.yml
18
.drone.yml
|
@ -1,19 +1,27 @@
|
|||
pipeline:
|
||||
test:
|
||||
# Library does not need to build
|
||||
#build:
|
||||
# image: golang:latest
|
||||
# commands:
|
||||
# - go get -d -t ./...
|
||||
# - go install
|
||||
test-coverage:
|
||||
image: golang:latest
|
||||
commands:
|
||||
- go get -d -t ./...
|
||||
- go get -u github.com/mattn/goveralls
|
||||
- go get -u golang.org/x/tools/cmd/cover
|
||||
- ./.test-coverage
|
||||
- go get -d -t ./...
|
||||
- ./contrib/ci/check-coverage drone.io
|
||||
codestyle:
|
||||
image: golang:latest
|
||||
commands:
|
||||
- go get -d -t ./...
|
||||
- ./contrib/ci/check-testfiles
|
||||
- ./contrib/ci/check-gofmt
|
||||
- go get github.com/client9/misspell/cmd/misspell
|
||||
- misspell -error .
|
||||
- if [ -n "$(gofmt -s -l .)" ]; then echo "Go code is not formatted, run 'gofmt -s -w .'" >&2; exit 1; fi
|
||||
test-race:
|
||||
image: golang:latest
|
||||
commands:
|
||||
- go get -d -t ./...
|
||||
- go test -v -cover --race ./...
|
||||
- go test -race ./...
|
||||
|
|
11
.travis.yml
11
.travis.yml
|
@ -3,3 +3,14 @@ go:
|
|||
- tip
|
||||
install:
|
||||
- go get -t dev.sum7.eu/genofire/golang-lib/...
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get github.com/client9/misspell/cmd/misspell
|
||||
script:
|
||||
- cd $GOPATH/src/dev.sum7.eu/genofire/golang-lib
|
||||
# - go install # Library does not need to build
|
||||
- ./contrib/ci/check-coverage travis-ci
|
||||
- ./contrib/ci/check-testfiles
|
||||
- ./contrib/ci/check-gofmt
|
||||
- misspell -error .
|
||||
- go test -race ./...
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
[![DroneCI](https://ci.sum7.eu/api/badges/genofire/golang-lib/status.svg?branch=master)](https://ci.sum7.eu/genofire/golang-lib)
|
||||
[![Travis](https://travis-ci.org/genofire/golang-lib.svg?branch=master)](https://travis-ci.org/genofire/golang-lib) [![CircleCI](https://circleci.com/gh/genofire/golang-lib/tree/master.svg?style=shield)](https://circleci.com/gh/genofire/golang-lib/tree/master)
|
||||
[![Coverage](https://coveralls.io/repos/github/genofire/golang-lib/badge.svg?branch=master)](https://coveralls.io/github/genofire/golang-lib?branch=master)
|
||||
[![codecov](https://codecov.io/gh/genofire/golang-lib/branch/master/graph/badge.svg)](https://codecov.io/gh/genofire/golang-lib)
|
||||
[![Go Report Card](https://goreportcard.com/badge/dev.sum7.eu/genofire/golang-lib)](https://goreportcard.com/report/dev.sum7.eu/genofire/golang-lib)
|
||||
[![GoDoc](https://godoc.org/dev.sum7.eu/genofire/golang-lib?status.svg)](https://godoc.org/dev.sum7.eu/genofire/golang-lib)
|
||||
|
||||
some packages collected for easy and often used functions
|
||||
|
|
68
circle.yml
68
circle.yml
|
@ -1,18 +1,50 @@
|
|||
machine:
|
||||
environment:
|
||||
GOROOT: ""
|
||||
PATH: "/usr/local/go/bin:/usr/local/go_workspace/bin:~/.go_workspace/bin:${PATH}"
|
||||
GOPATH: "${HOME}/.go_workspace"
|
||||
|
||||
dependencies:
|
||||
override:
|
||||
- mkdir -p ~/.go_workspace/src/github.com/${CIRCLE_PROJECT_USERNAME}
|
||||
- ln -s ${HOME}/${CIRCLE_PROJECT_REPONAME} ${HOME}/.go_workspace/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
|
||||
- go get -t -d -v ./...
|
||||
|
||||
test:
|
||||
pre:
|
||||
- go get -u github.com/mattn/goveralls
|
||||
- go get -u golang.org/x/tools/cmd/cover
|
||||
override:
|
||||
- ./.test-coverage circle-ci
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/golang:latest
|
||||
working_directory: /go/src/github.com/genofire/golang-lib
|
||||
steps:
|
||||
- checkout
|
||||
- run: go get -d -t ./...
|
||||
- run: go install
|
||||
test-coverage:
|
||||
docker:
|
||||
- image: circleci/golang:latest
|
||||
working_directory: /go/src/github.com/genofire/golang-lib
|
||||
steps:
|
||||
- checkout
|
||||
- run: go get -d -t ./...
|
||||
- run: go get github.com/mattn/goveralls
|
||||
- run: go get golang.org/x/tools/cmd/cover
|
||||
- run: ./contrib/ci/check-coverage circle-ci
|
||||
- store_test_results:
|
||||
path: ./
|
||||
destination: profile.cov
|
||||
codestyle:
|
||||
docker:
|
||||
- image: circleci/golang:latest
|
||||
working_directory: /go/src/github.com/genofire/golang-lib
|
||||
steps:
|
||||
- checkout
|
||||
- run: go get -d -t ./...
|
||||
- run: ./contrib/ci/check-testfiles
|
||||
- run: ./contrib/ci/check-gofmt
|
||||
- run: go get github.com/client9/misspell/cmd/misspell
|
||||
- run: misspell -error .
|
||||
test_race:
|
||||
docker:
|
||||
- image: circleci/golang:latest
|
||||
working_directory: /go/src/github.com/genofire/golang-lib
|
||||
steps:
|
||||
- checkout
|
||||
- run: go get -d -t ./...
|
||||
- run: go test -race ./...
|
||||
workflows:
|
||||
version: 2
|
||||
build_and_tests:
|
||||
jobs:
|
||||
#- build # Library does not need to build
|
||||
- test-coverage
|
||||
- codestyle
|
||||
- test_race
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
CI=$1
|
||||
echo "run for $CI"
|
||||
|
||||
# circle-ci
|
||||
# travis-ci
|
||||
# travis-pro
|
||||
|
||||
|
||||
if [ "$CI" == "circle-ci" ]; then
|
||||
cd ${GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
|
||||
fi
|
||||
|
@ -25,9 +30,14 @@ do
|
|||
done
|
||||
|
||||
# Failures have incomplete results, so don't send
|
||||
if [ "$FAIL" -eq 0 ]; then
|
||||
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -f profile.cov
|
||||
[ "$FAIL" -ne 0 ] && exit 1
|
||||
|
||||
# ci not publishing
|
||||
[ "$CI" == "" ] && exit 0
|
||||
|
||||
if [ "$CODECOV_TOKEN" != "" ]; then
|
||||
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -f profile.cov
|
||||
fi
|
||||
if [ "$COVERALLS_REPO_TOKEN" != "" ] ; then
|
||||
goveralls -v -coverprofile=profile.cov -service=$CI -repotoken=$COVERALLS_REPO_TOKEN
|
||||
fi
|
||||
|
||||
exit $FAIL
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
result="$(gofmt -s -l . | grep -v '^vendor/' )"
|
||||
if [ -n "$result" ]; then
|
||||
echo "Go code is not formatted, run 'gofmt -s -w .'" >&2
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# checks if every desired package has test files
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
source_re = re.compile(".*\.go")
|
||||
test_re = re.compile(".*_test\.go")
|
||||
missing = False
|
||||
|
||||
for root, dirs, files in os.walk("."):
|
||||
# ignore some paths
|
||||
if root == "." or root == "./database/graphite" or root.startswith("./vendor") or root.startswith("./."):
|
||||
continue
|
||||
|
||||
# source files but not test files?
|
||||
if len(filter(source_re.match, files)) > 0 and len(filter(test_re.match, files)) == 0:
|
||||
print("no test files for {}".format(root))
|
||||
missing = True
|
||||
|
||||
if missing:
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("every package has test files")
|
|
@ -54,7 +54,7 @@ func TestSaveJSON(t *testing.T) {
|
|||
err = SaveJSON(tmpfile.Name(), tmpfile.Name)
|
||||
assert.Error(err, "could not save func")
|
||||
|
||||
err = SaveJSON("/dev/null", 4)
|
||||
err = SaveJSON("/proc/readonly", 4)
|
||||
assert.Error(err, "could not save to /dev/null")
|
||||
|
||||
var testvalue int
|
||||
|
|
Loading…
Reference in New Issue