Merge pull request #1892 from halseth/travis-caching

travis cache
This commit is contained in:
Olaoluwa Osuntokun 2018-11-28 17:07:40 -08:00 committed by GitHub
commit 4e83ce5c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 39 deletions

@ -1,23 +1,49 @@
language: go language: go
matrix: cache:
include: directories:
- go: "1.11.x" - vendor/
env: RACE=TRUE USE_LINT=TRUE - $GOCACHE
- go: "1.11.x" - $GOPATH/src/github.com/btcsuite
env: RACE=FALSE USE_LINT=TRUE - $GOPATH/src/github.com/golang
- go: "1.10.x" - $GOPATH/src/gopkg.in/alecthomas
env: RACE=TRUE USE_LINT=FALSE
- go: "1.10.x" go:
env: RACE=FALSE USE_LINT=FALSE - "1.11.x"
env:
global:
- GOCACHE=$HOME/.go-build
matrix:
- RACE=true LINT=true
- ITEST=true
- COVER=true
sudo: required sudo: required
install: install:
- sudo add-apt-repository -y ppa:bitcoin/bitcoin -y - sudo add-apt-repository -y ppa:bitcoin/bitcoin -y
- sudo apt-get update -q - sudo apt-get update -q
- sudo apt-get install bitcoind -y - sudo apt-get install bitcoind -y
- export PATH=$PATH:$PWD/linux-amd64/ - export PATH=$PATH:$PWD/linux-amd64/
script: script:
- export PATH=$PATH:$GOPATH/bin # Common for all builds.
- make travis - make dep
- make btcd
# Run linter if LINT=true.
- 'if [ "$LINT" = true ]; then make lint ; fi'
# Run unit tests with race condition detector.
- 'if [ "$RACE" = true ]; then make unit-race ; fi'
# Run integration tests.
- 'if [ "$ITEST" = true ]; then make build ; fi'
- 'if [ "$ITEST" = true ]; then make itest-only ; fi'
# Run unit tests and generate coverage report.
- 'if [ "$COVER" = true ]; then make unit-cover; fi'
- 'if [ "$COVER" = true ]; then make goveralls; fi'
after_script: after_script:
- echo "Uploading to termbin.com..." && find *.log | xargs -I{} sh -c "cat {} | nc termbin.com 9999 | xargs -r0 printf '{} uploaded to %s'" - echo "Uploading to termbin.com..." && find *.log | xargs -I{} sh -c "cat {} | nc termbin.com 9999 | xargs -r0 printf '{} uploaded to %s'"
- echo "Uploading to file.io..." && tar -zcvO *.log | curl -s -F 'file=@-;filename=logs.tar.gz' https://file.io | xargs -r0 printf 'logs.tar.gz uploaded to %s\n' - echo "Uploading to file.io..." && tar -zcvO *.log | curl -s -F 'file=@-;filename=logs.tar.gz' https://file.io | xargs -r0 printf 'logs.tar.gz uploaded to %s\n'

@ -110,7 +110,6 @@ $(GOVERALLS_BIN):
$(LINT_BIN): $(LINT_BIN):
@$(call print, "Fetching gometalinter.v2") @$(call print, "Fetching gometalinter.v2")
go get -u $(LINT_PKG) go get -u $(LINT_PKG)
$(GOINSTALL) $(LINT_PKG)
dep: $(DEP_BIN) dep: $(DEP_BIN)
@$(call print, "Compiling dependencies.") @$(call print, "Compiling dependencies.")
@ -150,10 +149,12 @@ scratch: dep build
check: unit itest check: unit itest
itest: btcd build itest-only:
@$(call print, "Running integration tests.") @$(call print, "Running integration tests.")
$(ITEST) $(ITEST)
itest: btcd build itest-only
unit: btcd unit: btcd
@$(call print, "Running unit tests.") @$(call print, "Running unit tests.")
$(UNIT) $(UNIT)
@ -168,6 +169,10 @@ unit-race:
export CGO_ENABLED=1; env GORACE="history_size=7 halt_on_errors=1" $(UNIT_RACE) export CGO_ENABLED=1; env GORACE="history_size=7 halt_on_errors=1" $(UNIT_RACE)
export CGO_ENABLED=$(CGO_STATUS_QUO) export CGO_ENABLED=$(CGO_STATUS_QUO)
goveralls: $(GOVERALLS_BIN)
@$(call print, "Sending coverage report.")
$(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci
# ============= # =============
# FLAKE HUNTING # FLAKE HUNTING
# ============= # =============
@ -181,30 +186,6 @@ flake-unit:
GOTRACEBACK=all $(UNIT) -count=1 GOTRACEBACK=all $(UNIT) -count=1
while [ $$? -eq 0 ]; do /bin/sh -c "GOTRACEBACK=all $(UNIT) -count=1"; done while [ $$? -eq 0 ]; do /bin/sh -c "GOTRACEBACK=all $(UNIT) -count=1"; done
# ======
# TRAVIS
# ======
ifeq ($(RACE)$(USE_LINT), FALSETRUE)
travis: dep lint build itest unit-cover $(GOVERALLS_BIN)
@$(call print, "Sending coverage report.")
$(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci
endif
ifeq ($(RACE)$(USE_LINT), FALSEFALSE)
travis: dep build itest unit-cover $(GOVERALLS_BIN)
@$(call print, "Sending coverage report.")
$(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci
endif
ifeq ($(RACE)$(USE_LINT), TRUETRUE)
travis: dep lint btcd unit-race
endif
ifeq ($(RACE)$(USE_LINT), TRUEFALSE)
travis: dep btcd unit-race
endif
# ========= # =========
# UTILITIES # UTILITIES
# ========= # =========
@ -243,13 +224,14 @@ clean:
install \ install \
scratch \ scratch \
check \ check \
itest-only \
itest \ itest \
unit \ unit \
unit-cover \ unit-cover \
unit-race \ unit-race \
goveralls \
flakehunter \ flakehunter \
flake-unit \ flake-unit \
travis \
fmt \ fmt \
lint \ lint \
list \ list \