-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
# code coverage and quality reports | ||
*.out | ||
|
||
# binaries | ||
cc-test-reporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,51 @@ | ||
sudo: false | ||
language: go | ||
os: linux | ||
|
||
cache: | ||
directories: | ||
- $HOME/.cache/go-build | ||
- $HOME/gopath/pkg/mod | ||
- "$HOME/.cache/go-build" | ||
- "$HOME/gopath/pkg/mod" | ||
|
||
env: | ||
global: | ||
- CODECLIMATE=https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 | ||
- GO111MODULE=on | ||
- GOFLAGS=-mod=vendor | ||
- CODECLIMATE=https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 | ||
|
||
go: | ||
- master | ||
- 1.x | ||
- 1.7.x | ||
- 1.8.x | ||
- 1.9.x | ||
- 1.10.x | ||
- 1.11.x | ||
- 1.12.x | ||
- 1.13.x | ||
|
||
matrix: | ||
- master | ||
- 1.x | ||
- 1.11.x | ||
- 1.12.x | ||
- 1.13.x | ||
- 1.14.x | ||
|
||
go_import_path: github.com/kamilsk/tracer | ||
|
||
jobs: | ||
allow_failures: | ||
- go: 1.7.x | ||
- go: 1.8.x | ||
- go: 1.9.x | ||
- go: master | ||
|
||
before_script: | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then curl -L $CODECLIMATE > ./cc-test-reporter; fi | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then chmod +x ./cc-test-reporter; fi | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then ./cc-test-reporter before-build; fi | ||
- | | ||
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then | ||
curl -L $CODECLIMATE > /home/travis/gopath/bin/cc-test-reporter | ||
chmod +x /home/travis/gopath/bin/cc-test-reporter | ||
cc-test-reporter before-build | ||
fi | ||
script: | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then make test-with-coverage-profile; else make test; fi | ||
- | | ||
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then | ||
make test-with-coverage-profile | ||
else | ||
make test | ||
fi | ||
after_script: | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then export EXIT_CODE=$TRAVIS_TEST_RESULT; fi | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then export PREFIX=$(basename $(go list -m)); fi | ||
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then ./cc-test-reporter after-build -t gocov -p $PREFIX; fi | ||
- | | ||
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then | ||
cc-test-reporter after-build -t gocov -p $(basename $(go list -m)) --exit-code $TRAVIS_TEST_RESULT | ||
fi | ||
notifications: | ||
slack: octolab:1eMS7IqOArBipiu31jYVd0cN | ||
slack: | ||
secure: VHWCBgcxc9BejOM9pSTqAyXzZN6DEW/UzJKGkNX+lWL1wREIDmJ7iFKM1ZUfTwU6j5WtOE4ruJlfpUlmmlzicqTZUBIkGCJH6LoX9kwP+6IKBD/aCFuGwRuptKKU0I8pLV6Jvs2m2WQBlKQrfSX9IIM4zqb0M+ST067huwRscJP/4bJJ2aPg+dQiGeR3VHLit/izMRzk/IjnT093i3qGlXDhdRZrxnlqd5flmSlnU5sBTfRr9wHcMdrxIXK3smhay/w8M7XeuIgpv9mUjizmg5e+bQkm4e8AZZxYasvUQAdLWWylcwMk9xPHYy9QGKRFTSl1weon6rRrXWVXP1b9PpR8PYeg1qPvV0k+QNKokDdveqzd2N6ZAilRqAMNVYYYnI1fgLTySfBdIXKMwZAM8OnQk0BBBfyPp+FkoB/zewC6pFy54w7gM2pjefdV3RWjOsc6ux/W6Ro2msZufDW1OzJU4Yj4uzWCtZdsjjkGcA2fB9cDQWlhhmkYVpc7tDfhQ2GFgRmTvuvCvZP2jfUbHcMTgK1CW0+zbX5gsGorWCrMvHL6boV3iRydndOvCFKBUFdDDPvKBjbRIJRuoNprpSmhjWwRYZdUUD+HU/S64vm4mKiWoLhP3hUeDHKSg26F7GomvEGoVz2MCkaqXteRUi9tAhNJIjy88a/l354IMWg= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 OctoLab, https://www.octolab.org/ <[email protected]> | ||
Copyright (c) 2020 OctoLab, https://www.octolab.org/ <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,118 @@ | ||
# sourced by https://github.com/octomation/makefiles | ||
|
||
.DEFAULT_GOAL = test-with-coverage | ||
|
||
SHELL = /bin/bash -euo pipefail | ||
|
||
GO111MODULE = on | ||
GOFLAGS = -mod=vendor | ||
MODULE = $(shell go list -m) | ||
PACKAGES = $(shell go list ./...) | ||
PATHS = $(shell go list ./... | sed -e "s|\s+$(shell go list -m)/\{0,1\}||g") | ||
SHELL = /bin/bash -euo pipefail | ||
GOPRIVATE = go.octolab.net | ||
GOPROXY = direct | ||
LOCAL = $(MODULE) | ||
MODULE = `go list -m` | ||
PACKAGES = `go list ./... 2> /dev/null` | ||
PATHS = $(shell echo $(PACKAGES) | sed -e "s|$(MODULE)/\{0,1\}||g") | ||
TIMEOUT = 1s | ||
|
||
.DEFAULT_GOAL = test-with-coverage | ||
ifeq (, $(PACKAGES)) | ||
PACKAGES = $(MODULE) | ||
endif | ||
|
||
.PHONY: env | ||
env: | ||
@echo "GO111MODULE: $(GO111MODULE)" | ||
@echo "GOFLAGS: $(GOFLAGS)" | ||
ifeq (, $(PATHS)) | ||
PATHS = . | ||
endif | ||
|
||
export GO111MODULE := $(GO111MODULE) | ||
export GOFLAGS := $(GOFLAGS) | ||
export GOPRIVATE := $(GOPRIVATE) | ||
export GOPROXY := $(GOPROXY) | ||
|
||
.PHONY: go-env | ||
go-env: | ||
@echo "GO111MODULE: `go env GO111MODULE`" | ||
@echo "GOFLAGS: $(strip `go env GOFLAGS`)" | ||
@echo "GOPRIVATE: $(strip `go env GOPRIVATE`)" | ||
@echo "GOPROXY: $(strip `go env GOPROXY`)" | ||
@echo "LOCAL: $(LOCAL)" | ||
@echo "MODULE: $(MODULE)" | ||
@echo "PACKAGES: $(PACKAGES)" | ||
@echo "PATHS: $(PATHS)" | ||
@echo "SHELL: $(SHELL)" | ||
@echo "PATHS: $(strip $(PATHS))" | ||
@echo "TIMEOUT: $(TIMEOUT)" | ||
|
||
.PHONY: deps-check | ||
deps-check: | ||
@go mod verify | ||
@if command -v egg > /dev/null; then \ | ||
egg deps check license; \ | ||
egg deps check version; \ | ||
fi | ||
|
||
.PHONY: deps | ||
deps: | ||
@go mod tidy && go mod vendor && go mod verify | ||
.PHONY: deps-clean | ||
deps-clean: | ||
@go clean -modcache | ||
|
||
.PHONY: format | ||
format: | ||
@goimports -local $(dir $(shell go list -m)) -ungroup -w $(PATHS) | ||
.PHONY: deps-shake | ||
deps-shake: | ||
@go mod tidy | ||
|
||
.PHONY: generate | ||
generate: | ||
@go generate $(PACKAGES) | ||
.PHONY: module-deps | ||
module-deps: | ||
@go mod download | ||
@if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi | ||
|
||
.PHONY: update | ||
update: selector = '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' | ||
update: | ||
@go get -mod= -u | ||
@if command -v egg > /dev/null; then \ | ||
packages="`egg deps list`"; \ | ||
else \ | ||
packages="`go list -f $(selector) -m all`"; \ | ||
fi; go get -d -mod= -u $$packages | ||
|
||
.PHONY: refresh | ||
refresh: update deps generate format test-with-coverage | ||
.PHONY: update-all | ||
update-all: | ||
@go get -d -mod= -u ./... | ||
|
||
.PHONY: format | ||
format: | ||
@goimports -local $(LOCAL) -ungroup -w $(PATHS) | ||
|
||
.PHONY: go-generate | ||
go-generate: | ||
@go generate $(PACKAGES) | ||
|
||
.PHONY: lint | ||
lint: | ||
@golangci-lint run ./... | ||
|
||
.PHONY: test | ||
test: | ||
@go test -race -timeout $(TIMEOUT) $(PACKAGES) | ||
|
||
.PHONY: test-clean | ||
test-clean: | ||
@go clean -testcache | ||
|
||
.PHONY: test-with-coverage | ||
test-with-coverage: | ||
@go test -cover -timeout $(TIMEOUT) $(PACKAGES) | column -t | sort -r | ||
|
||
.PHONY: test-with-coverage-profile | ||
test-with-coverage-profile: | ||
@go test -cover -covermode count -coverprofile c.out -timeout $(TIMEOUT) $(PACKAGES) | ||
|
||
|
||
.PHONY: clean | ||
clean: deps-clean test-clean | ||
|
||
.PHONY: deps | ||
deps: module-deps | ||
|
||
.PHONY: env | ||
env: go-env | ||
|
||
.PHONY: generate | ||
generate: go-generate format | ||
|
||
.PHONY: refresh | ||
refresh: deps-shake update deps generate format test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters