Change build settings to speed up builds

1. Don't run long steps for Go versions other than 1.9 & 1.10
according to Golang Release Policy (two latest versions).

2. Switch to codecov.io, collect coverage only on Go 1.10 which
has fixes for multi-module coverage & ./... ignoring vendor.

3. Simplify Makefile.
This commit is contained in:
Andrey Smirnov
2018-04-17 00:33:30 +03:00
parent 797b2dd996
commit 2a8aff9746
4 changed files with 35 additions and 41 deletions

3
.gitignore vendored
View File

@@ -22,8 +22,7 @@ _testmain.go
*.exe
*.test
coverage.html
coverage*.out
coverage.txt
*.pyc

View File

@@ -3,12 +3,6 @@ sudo: required
language: go
go:
- 1.8.x
- 1.9.x
- 1.10.x
- master
go_import_path: github.com/smira/aptly
addons:
@@ -19,11 +13,26 @@ addons:
env:
global:
- secure: "YSwtFrMqh4oUvdSQTXBXMHHLWeQgyNEL23ChIZwU0nuDGIcQZ65kipu0PzefedtUbK4ieC065YCUi4UDDh6gPotB/Wu1pnYg3dyQ7rFvhaVYAAUEpajAdXZhlx+7+J8a4FZMeC/kqiahxoRgLbthF9019ouIqhGB9zHKI6/yZwc="
- secure: "EcCzJsqQ3HnIkprBPS1YHErsETcb7KQFBYEzVDE7RYDApWeapLq+r/twMtWMd/fkGeLzr3kWSg7nhSadeHMLYeMl9j+U7ncC5CWG5NMBOj/jowlb9cMCCDlmzMoZLAgR6jm1cJyrWCLsWVlv+D0ZiB0fx4xaBZP/gIr9g6nEwC8="
- secure: "OxiVNmre2JzUszwPNNilKDgIqtfX2gnRSsVz6nuySB1uO2yQsOQmKWJ9cVYgH2IB5H8eWXKOhexcSE28kz6TPLRuEcU9fnqKY3uEkdwm7rJfz9lf+7C4bJEUdA1OIzJppjnWUiXxD7CEPL1DlnMZM24eDQYqa/4WKACAgkK53gE="
- NO_FTP_ACCESS: "yes"
- BOTO_CONFIG: /dev/null
matrix:
allow_failures:
- go: master
env: RUN_LONG_TESTS=no
fast_finish: true
include:
- go: 1.8.x
env: RUN_LONG_TESTS=no
- go: 1.9.x
env: RUN_LONG_TESTS=yes
- go: 1.10.x
env: RUN_LONG_TESTS=yes
- go: master
env: RUN_LONG_TESTS=no
before_install:
- virtualenv system/env
- . system/env/bin/activate
@@ -31,14 +40,12 @@ before_install:
- pip install -U pip setuptools
- pip install -r system/requirements.txt
- make version
install:
- make prepare
script: make travis
matrix:
allow_failures:
- go: master
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
webhooks:

View File

@@ -4,19 +4,13 @@ PACKAGES=context database deb files gpg http query swift s3 utils
PYTHON?=python
TESTS?=
BINPATH?=$(GOPATH)/bin
RUN_LONG_TESTS?=yes
ifeq ($(GOVERSION), devel)
TRAVIS_TARGET=coveralls
else
TRAVIS_TARGET=test
endif
GO_1_10_AND_HIGHER=$(shell (printf '%s\n' go1.10 $(GOVERSION) | sort -cV >/dev/null 2>&1) && echo "yes")
all: test check system-test
prepare:
go get -u github.com/mattn/goveralls
go get -u github.com/axw/gocov/gocov
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/alecthomas/gometalinter
gometalinter --install
@@ -24,45 +18,39 @@ dev:
go get -u github.com/golang/dep/...
go get -u github.com/laher/goxc
coverage.out:
rm -f coverage.*.out
for i in $(PACKAGES); do go test -coverprofile=coverage.$$i.out -covermode=count ./$$i; done
echo "mode: count" > coverage.out
grep -v -h "mode: count" coverage.*.out >> coverage.out
rm -f coverage.*.out
coverage: coverage.out
go tool cover -html=coverage.out
rm -f coverage.out
check: system/env
ifeq ($(RUN_LONG_TESTS), yes)
if [ -x travis_wait ]; then \
travis_wait gometalinter --config=linter.json ./...; \
else \
gometalinter --config=linter.json ./...; \
fi
. system/env/bin/activate && flake8 --max-line-length=200 --exclude=system/env/ system/
endif
install:
go install -v -ldflags "-X main.Version=$(VERSION)"
system/env: system/requirements.txt
ifeq ($(RUN_LONG_TESTS), yes)
rm -rf system/env
virtualenv system/env
system/env/bin/pip install -r system/requirements.txt
endif
system-test: install system/env
ifeq ($(RUN_LONG_TESTS), yes)
if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
PATH=$(BINPATH)/:$(PATH) && . system/env/bin/activate && APTLY_VERSION=$(VERSION) $(PYTHON) system/run.py --long $(TESTS)
travis: $(TRAVIS_TARGET) check system-test
endif
test:
ifeq ($(GO_1_10_AND_HIGHER), yes)
go test -v ./... -gocheck.v=true -race -coverprofile=coverage.txt -covermode=atomic
else
go test -v `go list ./... | grep -v vendor/` -gocheck.v=true
coveralls: coverage.out
$(BINPATH)/goveralls -service travis-ci.org -coverprofile=coverage.out -repotoken=$(COVERALLS_TOKEN)
endif
mem.png: mem.dat mem.gp
gnuplot mem.gp
@@ -83,4 +71,4 @@ man:
version:
@echo $(VERSION)
.PHONY: coverage.out man version
.PHONY: man version

View File

@@ -5,8 +5,8 @@ aptly
.. image:: https://api.travis-ci.org/smira/aptly.svg?branch=master
:target: https://travis-ci.org/smira/aptly
.. image:: https://coveralls.io/repos/smira/aptly/badge.svg?branch=master
:target: https://coveralls.io/r/smira/aptly?branch=master
.. image:: https://codecov.io/gh/smira/aptly/branch/master/graph/badge.svg
:target: https://codecov.io/gh/smira/aptly
.. image:: https://badges.gitter.im/Join Chat.svg
:target: https://gitter.im/smira/aptly?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge