Skip to content

Commit

Permalink
build: Add fmt and coverage make targets (#489)
Browse files Browse the repository at this point in the history
Running fmt becomes a prerequisite for building chamber, helping to keep
the code formatted.

The coverage target runs basic code coverage tests, and sets the stage
for reporting.
  • Loading branch information
bhavanki authored May 15, 2024
1 parent 0c44863 commit 044a5c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*~
*.sw[a-z]
dist/
/chamber
/coverage.out
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ SRC := $(shell find . -name '*.go')
test: store/awsapi_mock.go
go test -v ./...

.PHONY: coverage
coverage:
go test -coverpkg ./... -coverprofile coverage.out ./...

store/awsapi_mock.go: store/awsapi.go
ifdef MOQ
rm -f $@
Expand All @@ -41,9 +45,12 @@ clean:
dist/:
mkdir -p dist

fmt:
go fmt ./...

build: chamber

chamber: $(SRC)
chamber: fmt $(SRC)
CGO_ENABLED=0 go build -trimpath $(LDFLAGS) -o $@

dist/chamber-$(VERSION)-darwin-amd64: | dist/
Expand All @@ -64,4 +71,4 @@ dist/chamber-$(VERSION)-linux-arm64 dist/chamber-$(VERSION)-linux-aarch64: | dis
dist/chamber-$(VERSION)-windows-amd64.exe: | dist/
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath $(LDFLAGS) -o $@

.PHONY: clean all linux
.PHONY: clean all fmt build linux

0 comments on commit 044a5c3

Please sign in to comment.