Add ci-coverage make target to build coverage in a container

This commit is contained in:
Buddy Sandidge 2021-09-19 22:23:32 -07:00
parent 1ae130ff97
commit 378f676c72
4 changed files with 15 additions and 2 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
coverage
.git
.idea

3
.gitignore vendored
View File

@ -1 +1,2 @@
coverage/
/coverage
/.idea

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM golang:1.17.1
ADD . /app
WORKDIR /app

View File

@ -1,10 +1,15 @@
SHELL = bash
SHELL := /bin/bash
.PHONY: coverage
test:
go test ./...
ci-coverage:
[[ -d coverage ]] || mkdir coverage
podman build --tag tmpl-coverage .
podman run --interactive --tty --rm --volume $$(pwd)/coverage:/app/coverage tmpl-coverage make coverage
coverage:
[[ -d coverage ]] || mkdir coverage
go test -coverpkg=./... -coverprofile=coverage/index.out ./...