mirror of https://github.com/docker/docs.git
Start running without the pkcs11 buildtag in CI, and generate coverage.
Signed-off-by: Ying Li <ying.li@docker.com> Signed-off-by: David Lawrence <david.lawrence@docker.com> Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
This commit is contained in:
parent
1d1e2483a1
commit
cf85394b4c
29
Makefile
29
Makefile
|
@ -15,7 +15,7 @@ GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)"
|
||||||
GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static"
|
GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static"
|
||||||
GOOSES = darwin freebsd linux
|
GOOSES = darwin freebsd linux
|
||||||
GOARCHS = amd64
|
GOARCHS = amd64
|
||||||
NOTARY_BUILDTAGS="pkcs11"
|
NOTARY_BUILDTAGS ?= "pkcs11"
|
||||||
GO_EXC = go
|
GO_EXC = go
|
||||||
NOTARYDIR := /go/src/github.com/docker/notary
|
NOTARYDIR := /go/src/github.com/docker/notary
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ else
|
||||||
$(error You are importing pkcs11 somewhere and not using a build tag)
|
$(error You are importing pkcs11 somewhere and not using a build tag)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
_empty :=
|
||||||
|
_space := $(empty) $(empty)
|
||||||
|
|
||||||
# go cover test variables
|
# go cover test variables
|
||||||
COVERDIR=.cover
|
COVERDIR=.cover
|
||||||
COVERPROFILE=$(COVERDIR)/cover.out
|
COVERPROFILE=$(COVERDIR)/cover.out
|
||||||
|
@ -82,16 +85,16 @@ lint:
|
||||||
|
|
||||||
build: go_version
|
build: go_version
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
@go build -tags ${NOTARY_BUILDTAGS} -v ${GO_LDFLAGS} ./...
|
@go build -tags "${NOTARY_BUILDTAGS}" -v ${GO_LDFLAGS} ./...
|
||||||
|
|
||||||
test: OPTS =
|
test: TESTOPTS =
|
||||||
test: go_version
|
test: go_version
|
||||||
@echo "+ $@ $(OPTS)"
|
@echo "+ $@ $(TESTOPTS)"
|
||||||
go test -tags ${NOTARY_BUILDTAGS} $(OPTS) ./...
|
go test -tags "${NOTARY_BUILDTAGS}" $(TESTOPTS) ./...
|
||||||
|
|
||||||
test-full: vet lint
|
test-full: vet lint
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
go test -tags ${NOTARY_BUILDTAGS} -v ./...
|
go test -tags "${NOTARY_BUILDTAGS}" -v ./...
|
||||||
|
|
||||||
protos:
|
protos:
|
||||||
@protoc --go_out=plugins=grpc:. proto/*.proto
|
@protoc --go_out=plugins=grpc:. proto/*.proto
|
||||||
|
@ -103,25 +106,24 @@ protos:
|
||||||
# be run first
|
# be run first
|
||||||
|
|
||||||
define gocover
|
define gocover
|
||||||
$(GO_EXC) test $(OPTS) -covermode="$(COVERMODE)" -coverprofile="$(COVERDIR)/$(subst /,-,$(1)).cover" "$(1)" || exit 1;
|
$(GO_EXC) test $(OPTS) $(TESTOPTS) -covermode="$(COVERMODE)" -coverprofile="$(COVERDIR)/$(subst /,-,$(1)).$(subst $(_space),.,$(NOTARY_BUILDTAGS)).cover" "$(1)" || exit 1;
|
||||||
endef
|
endef
|
||||||
|
|
||||||
gen-cover: go_version
|
gen-cover: go_version
|
||||||
@rm -rf "$(COVERDIR)"
|
|
||||||
@mkdir -p "$(COVERDIR)"
|
@mkdir -p "$(COVERDIR)"
|
||||||
$(foreach PKG,$(PKGS),$(call gocover,$(PKG)))
|
$(foreach PKG,$(PKGS),$(call gocover,$(PKG)))
|
||||||
|
|
||||||
cover: GO_EXC := go
|
cover: GO_EXC := go
|
||||||
OPTS = -coverpkg "$(shell ./coverpkg.sh $(1) $(NOTARY_PKG))"
|
OPTS = -tags "${NOTARY_BUILDTAGS}" -coverpkg "$(shell ./coverpkg.sh $(1) $(NOTARY_PKG))"
|
||||||
cover: gen-cover
|
cover: gen-cover covmerge
|
||||||
@gocovmerge $(shell ls -1 $(COVERDIR)/* | tr "\n" " ") > $(COVERPROFILE)
|
|
||||||
@go tool cover -func="$(COVERPROFILE)"
|
|
||||||
@go tool cover -html="$(COVERPROFILE)"
|
@go tool cover -html="$(COVERPROFILE)"
|
||||||
|
|
||||||
# Codecov knows how to merge multiple coverage files
|
# Codecov knows how to merge multiple coverage files
|
||||||
ci: OPTS = -tags ${NOTARY_BUILDTAGS} -race -coverpkg "$(shell ./coverpkg.sh $(1) $(NOTARY_PKG))"
|
ci: OPTS = -tags "${NOTARY_BUILDTAGS}" -race -coverpkg "$(shell ./coverpkg.sh $(1) $(NOTARY_PKG))"
|
||||||
GO_EXC := godep go
|
GO_EXC := godep go
|
||||||
ci: gen-cover
|
ci: gen-cover
|
||||||
|
|
||||||
|
covmerge:
|
||||||
@gocovmerge $(shell ls -1 $(COVERDIR)/* | tr "\n" " ") > $(COVERPROFILE)
|
@gocovmerge $(shell ls -1 $(COVERDIR)/* | tr "\n" " ") > $(COVERPROFILE)
|
||||||
@go tool cover -func="$(COVERPROFILE)"
|
@go tool cover -func="$(COVERPROFILE)"
|
||||||
|
|
||||||
|
@ -157,4 +159,5 @@ shell: notary-dockerfile
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
|
@rm -rf "$(COVERDIR)"
|
||||||
@rm -rf "${PREFIX}/bin/notary-server" "${PREFIX}/bin/notary" "${PREFIX}/bin/notary-signer"
|
@rm -rf "${PREFIX}/bin/notary-server" "${PREFIX}/bin/notary" "${PREFIX}/bin/notary-signer"
|
||||||
|
|
12
circle.yml
12
circle.yml
|
@ -45,6 +45,10 @@ test:
|
||||||
# Output the go versions we are going to test
|
# Output the go versions we are going to test
|
||||||
- gvm use stable && go version
|
- gvm use stable && go version
|
||||||
|
|
||||||
|
# CLEAN
|
||||||
|
- gvm use stable && make clean:
|
||||||
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
# FMT
|
# FMT
|
||||||
- gvm use stable && make fmt:
|
- gvm use stable && make fmt:
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
@ -59,11 +63,17 @@ test:
|
||||||
|
|
||||||
override:
|
override:
|
||||||
# Test stable, and report
|
# Test stable, and report
|
||||||
- gvm use stable && make ci:
|
# hacking this to be parallel
|
||||||
|
- case $CIRCLE_NODE_INDEX in 0) gvm use stable && NOTARY_BUILDTAGS=pkcs11 make ci ;; 1) gvm use stable && NOTARY_BUILDTAGS=none make ci ;; esac:
|
||||||
|
parallel: true
|
||||||
timeout: 600
|
timeout: 600
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
post:
|
post:
|
||||||
|
- gvm use stable && make covmerge:
|
||||||
|
timeout: 600
|
||||||
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
# Report to codecov.io
|
# Report to codecov.io
|
||||||
# - bash <(curl -s https://codecov.io/bash):
|
# - bash <(curl -s https://codecov.io/bash):
|
||||||
# pwd: $BASE_STABLE
|
# pwd: $BASE_STABLE
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/docker/notary"
|
|
||||||
"github.com/docker/notary/cryptoservice"
|
"github.com/docker/notary/cryptoservice"
|
||||||
"github.com/docker/notary/keystoremanager"
|
"github.com/docker/notary/keystoremanager"
|
||||||
"github.com/docker/notary/passphrase"
|
"github.com/docker/notary/passphrase"
|
||||||
|
@ -22,7 +21,7 @@ func NewNotaryRepository(baseDir, gun, baseURL string, rt http.RoundTripper,
|
||||||
retriever passphrase.Retriever) (*NotaryRepository, error) {
|
retriever passphrase.Retriever) (*NotaryRepository, error) {
|
||||||
fileKeyStore, err := trustmanager.NewKeyFileStore(baseDir, retriever)
|
fileKeyStore, err := trustmanager.NewKeyFileStore(baseDir, retriever)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create private key store in directory: %s", keysPath)
|
return nil, fmt.Errorf("failed to create private key store in directory: %s", baseDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
keyStoreManager, err := keystoremanager.NewKeyStoreManager(baseDir, fileKeyStore)
|
keyStoreManager, err := keystoremanager.NewKeyStoreManager(baseDir, fileKeyStore)
|
||||||
|
|
Loading…
Reference in New Issue