Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/.vscode/
/bin/
cover.out
crosscover.out
37 changes: 24 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
dist: trusty
sudo: required
dist: xenial
language: go

services:
- docker

go:
- 1.12.x
# - TODO master
Expand All @@ -10,16 +12,19 @@ matrix:
allow_failures:
- go: master

before_cache:
- go clean -testcache

cache:
directories:
- /home/travis/.cache/go-build
- /home/travis/gopath/pkg
# - /home/travis/gopath/pkg

before_cache:
- go clean -testcache
# - go clean -cache

env:
global:
- CODECOV_ENV=PROMETHEUS_IMAGE,GRAFANA_IMAGE,POSTGRES_IMAGE

# Secure variables are not exposed for external pull requests: https://docs.travis-ci.com/user/pull-requests#Pull-Requests-and-Security-Restrictions
# AWS_ACCESS_KEY_ID
- secure: "jOUSuGO6F6wH8nn5Xq6tIR2ADQywVSqX5YJIAsxuJ1ICGv9zsL1KuGq3El5Li3EMk79IwlrocTCJVIHxcps8qOCK129pTmuWhwGGfipCd8MzkPIWhwLso7eH+RxKSrkoBfYl7U8xQokyv/0EmGSsrz2EpopQIbcK/lVyT5GYEnc/Vz2doGO8beNPtUAg3753wYt43KOguyuPHNyklGCihQWFlH8BxTuS53zZeGBSXijxif25bCBSQza0FAMrG6k4msxP5+rDYkxzKMDmXP2dovTpX5pfgG94uCXQnWOa+FSS4BA/CcHKbWezK0w5h4SXLsQ6aJxJFl8CIO9ARAluUSA/caR+Pc5ndO4GDbz/53vKIXe9Pg1qF1w+CuGGrwJJAihA1kUIA/s8E8VVu50xXZOx2OvJBaNGX1QahYHUOUjSiwPi/ddG+1jbrwgqBNyGMMlhwZteMDOwRsGfGlCDBQygu8IOROXeC3wFSGuA3UOkvtTX6Hjuug7D9/RHi/cYJHFawmvw+4883F0eAsogkl4B7xuNYXSEurfUsjz+3yQAt9KO/S3k2wMCNX8/aHSfahNQjLwX381gIw8Ky0W1qdEIh0069cDN1/hJtldwKegXw15YbBOM0wwzXxCk2tFXDhG9dE9QXzSvgcAD/oihJhQUD4/GNMoY8LuKfRTUJWE="
Expand All @@ -46,30 +51,36 @@ env:
GRAFANA_IMAGE=grafana/grafana:master
POSTGRES_IMAGE=postgres:latest

script:
- sudo service mysql stop
- sudo service postgresql stop
before_install:
- docker-compose up -d

install:
# ensure that vendor/ is in sync with code and Gopkg.toml/lock
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- dep check

before_script:
# ensure that generated files are not changed
- make init gen
- make init
- make gen
- git status
- git diff --exit-code

script:
# for main_test.go
- make install

- make check

- make test-cover
- make test-crosscover
- make test-race

- make check

after_success:
- bash <(curl -s https://codecov.io/bash) -X fix
- curl https://codecov.io/bash > codecov
- chmod +x codecov
- ./codecov -f cover.out -F cover -X fix
- ./codecov -f crosscover.out -F crosscover -X fix

notifications:
slack:
Expand Down
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ release: ## Build pmm-managed release binary.
init: ## Installs tools to $GOPATH/bin (which is expected to be in $PATH).
curl https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin

go install -v ./vendor/gopkg.in/reform.v1/reform \
./vendor/github.com/BurntSushi/go-sumtype \
./vendor/github.com/vektra/mockery/cmd/mockery
go install ./vendor/gopkg.in/reform.v1/reform \
./vendor/github.com/BurntSushi/go-sumtype \
./vendor/github.com/vektra/mockery/cmd/mockery

go get -u github.com/prometheus/prometheus/cmd/promtool

go test -v -i ./...
go test -v -race -i ./...
go test -i ./...
go test -race -i ./...

gen: ## Generate files.
rm -f models/*_reform.go
go generate ./...

install: ## Install pmm-managed binary.
go install -v $(LD_FLAGS) ./...
go install $(LD_FLAGS) ./...

install-race: ## Install pmm-managed binary with race detector.
go install -v $(LD_FLAGS) -race ./...
go install $(LD_FLAGS) -race ./...

TEST_FLAGS ?= -timeout=20s

Expand All @@ -51,9 +51,12 @@ test: ## Run tests.
test-race: ## Run tests with race detector.
go test $(TEST_FLAGS) -p 1 -race ./...

test-cover: ## Run tests and collect coverage information.
test-cover: ## Run tests and collect per-package coverage information.
go test $(TEST_FLAGS) -p 1 -coverprofile=cover.out -covermode=count ./...

test-crosscover: ## Run tests and collect cross-package coverage information.
go test $(TEST_FLAGS) -p 1 -coverprofile=crosscover.out -covermode=count -coverpkg=./... ./...

check: ## Run required checkers and linters.
go run .github/check-license.go
go-sumtype ./vendor/... ./...
Expand All @@ -80,7 +83,7 @@ run-race: install-race _run ## Run pmm-managed with race detector.
run-race-cover: install-race ## Run pmm-managed with race detector and collect coverage information.
go test -coverpkg="github.com/percona/pmm-managed/..." \
-tags maincover \
-v $(LD_FLAGS) \
$(LD_FLAGS) \
-race -c -o bin/pmm-managed.test
bin/pmm-managed.test -test.coverprofile=cover.out -test.run=TestMainCover $(RUN_FLAGS)

Expand Down