test: Add coverage output
This commit is contained in:
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -15,6 +15,8 @@ jobs:
|
||||
run: make lint
|
||||
- name: Run unit tests
|
||||
run: make unit-test
|
||||
- name: Get unit test coverage
|
||||
run: make unit-test-coverage
|
||||
- name: Build Linux binary
|
||||
run: make PLATFORM=linux/amd64
|
||||
- name: Build Windows binary
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# syntax = docker/dockerfile:1-experimental
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} golang:1.14.3-alpine AS base
|
||||
FROM --platform=${BUILDPLATFORM} golang:1.15.0-alpine AS base
|
||||
WORKDIR /src
|
||||
ENV CGO_ENABLED=0
|
||||
COPY go.* .
|
||||
@@ -16,7 +16,7 @@ RUN --mount=target=. \
|
||||
FROM base AS unit-test
|
||||
RUN --mount=target=. \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
go test -v .
|
||||
mkdir /out && go test -v -coverprofile=/out/cover.out ./...
|
||||
|
||||
FROM golangci/golangci-lint:v1.27-alpine AS lint-base
|
||||
|
||||
@@ -27,6 +27,9 @@ RUN --mount=target=. \
|
||||
--mount=type=cache,target=/root/.cache/golangci-lint \
|
||||
golangci-lint run --timeout 10m0s ./...
|
||||
|
||||
FROM scratch AS unit-test-coverage
|
||||
COPY --from=unit-test /out/cover.out /cover.out
|
||||
|
||||
FROM scratch AS bin-unix
|
||||
COPY --from=build /out/example /
|
||||
|
||||
|
||||
Reference in New Issue
Block a user