mirror of https://github.com/docker/cli.git
Upload coverage report from outside of test container.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
d79d903864
commit
f6d148c632
13
Makefile
13
Makefile
|
@ -12,20 +12,11 @@ clean:
|
||||||
# the "-tags daemon" part is temporary
|
# the "-tags daemon" part is temporary
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
|
./scripts/test/unit $(shell go list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
.PHONY: test-coverage
|
.PHONY: test-coverage
|
||||||
test-coverage:
|
test-coverage:
|
||||||
for pkg in $(shell go list ./... | grep -v /vendor/); do \
|
./scripts/test/unit-with-coverage
|
||||||
go test -tags daemon -v -cover -parallel 8 -coverprofile=profile.out -covermode=atomic $${pkg} || exit 1; \
|
|
||||||
if test -f profile.out; then \
|
|
||||||
cat profile.out >> coverage.txt && rm profile.out; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
.PHONY: codecov
|
|
||||||
codecov:
|
|
||||||
$(shell curl -s https://codecov.io/bash | bash)
|
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
|
|
|
@ -29,13 +29,16 @@ jobs:
|
||||||
docker run --name cross cli-builder make cross
|
docker run --name cross cli-builder make cross
|
||||||
docker cp cross:/go/src/github.com/docker/cli/build /work/build
|
docker cp cross:/go/src/github.com/docker/cli/build /work/build
|
||||||
- run:
|
- run:
|
||||||
name: "Unit Test"
|
name: "Unit Test with Coverage"
|
||||||
command: |
|
command: |
|
||||||
if [ "$CIRCLE_NODE_INDEX" != "2" ]; then exit; fi
|
if [ "$CIRCLE_NODE_INDEX" != "2" ]; then exit; fi
|
||||||
dockerfile=dockerfiles/Dockerfile.dev
|
dockerfile=dockerfiles/Dockerfile.dev
|
||||||
echo "COPY . ." >> $dockerfile
|
echo "COPY . ." >> $dockerfile
|
||||||
docker build -f $dockerfile --tag cli-builder .
|
docker build -f $dockerfile --tag cli-builder .
|
||||||
docker run cli-builder make test-coverage codecov
|
docker run --name test cli-builder make test-coverage
|
||||||
|
docker cp test:/go/src/github.com/docker/cli/coverage.txt coverage.txt
|
||||||
|
apk add -U bash curl
|
||||||
|
curl -s https://codecov.io/bash | bash
|
||||||
- run:
|
- run:
|
||||||
name: "Validate Vendor and Code Generation"
|
name: "Validate Vendor and Code Generation"
|
||||||
command: |
|
command: |
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
FROM golang:1.8-alpine
|
FROM golang:1.8-alpine
|
||||||
|
|
||||||
RUN apk add -U git make bash coreutils curl
|
RUN apk add -U git make bash coreutils
|
||||||
|
|
||||||
RUN go get github.com/LK4D4/vndr && \
|
RUN go get github.com/LK4D4/vndr && \
|
||||||
cp /go/bin/vndr /usr/bin && \
|
cp /go/bin/vndr /usr/bin && \
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
go test -tags daemon -v $@
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
for pkg in $(go list ./... | grep -v /vendor/); do
|
||||||
|
./scripts/test/unit \
|
||||||
|
-cover \
|
||||||
|
-coverprofile=profile.out \
|
||||||
|
-covermode=atomic \
|
||||||
|
${pkg}
|
||||||
|
|
||||||
|
if test -f profile.out; then
|
||||||
|
cat profile.out >> coverage.txt
|
||||||
|
rm profile.out
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue