Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update Makefile to run unit tests #25

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ GO_DIR = ./src
BIN_DIR = ./bin
TMP_DIR = ./tmp

# Go packages to test
TEST_PACKAGES = ./src/internal/config \
./src/internal/version

.PHONY: all
all: clean format modules build
all: clean format modules test build

.PHONY: clean
clean:
Expand All @@ -22,6 +26,16 @@ modules:
@# Verify dependencies have not been modified since being downloaded
go mod verify

.PHONY: test
test:
mkdir $(TMP_DIR) || true
go test -cover -covermode=count -coverprofile=$(TMP_DIR)/cover.out $(TEST_PACKAGES)

.PHONY: build
build:
CGO_ENABLED=0 go build -o $(BIN_DIR)/operator $(GO_DIR)

.PHONY: coverprofile
coverprofile:
go tool cover -html=$(TMP_DIR)/cover.out
go tool cover -func=$(TMP_DIR)/cover.out
Loading