Skip to content

Commit

Permalink
Run unit tests in CI. (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Jan 13, 2022
1 parent 74d0421 commit c0d64d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin
.idea
metal-cloud-config.yaml
cover.out
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.17-buster as builder
WORKDIR /work
COPY . .
RUN make all
RUN make

FROM alpine:3.14
RUN apk --update add ca-certificates
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
.ONESHELL:
SHA := $(shell git rev-parse --short=8 HEAD)
GITVERSION := $(shell git describe --long --all)
BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},devel)
GO := go
GOSRC = $(shell find . -not \( -path vendor -prune \) -type f -name '*.go')
DOCKER_TAG := $(or ${GIT_TAG_NAME}, latest)

export GO111MODULE := on
Expand All @@ -13,11 +10,9 @@ export CGO_ENABLED := 0
BINARY := metal-cloud-controller-manager
MAINMODULE := github.com/metal-stack/metal-ccm

.PHONY: all
all:: bin/$(BINARY);

bin/$(BINARY): $(GOSRC)
$(GO) build \
.PHONY: build
build: test
go build \
-trimpath \
-tags netgo \
-ldflags \
Expand All @@ -29,6 +24,10 @@ bin/$(BINARY): $(GOSRC)
$(MAINMODULE) \
&& strip bin/$(BINARY)

.PHONY: test
test:
go test -coverprofile cover.out -cover ./... && go tool cover -func cover.out

.PHONY: clean
clean:
rm -f bin/$(BINARY)
Expand Down

0 comments on commit c0d64d8

Please sign in to comment.