-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export YANGPATH=$(abspath ./yang) | ||
|
||
VER = 0.1.0 | ||
|
||
test: | ||
go test ./... | ||
|
||
# Just the popular ones. You can easily build binary for missing platform | ||
PLATFORMS = \ | ||
darwin-amd64 \ | ||
darwin-arm64 \ | ||
linux-amd64 \ | ||
windows-amd64 | ||
|
||
BIN_TARGETS = $(foreach P,$(PLATFORMS), bin/fc-yang-$(VER)-$(P)) | ||
|
||
dist: $(BIN_TARGETS) | ||
|
||
bin/fc-yang-$(VER)-darwin-amd64: BUILD_ENV=GOARCH=amd64 GOOS=darwin | ||
bin/fc-yang-$(VER)-darwin-arm64: BUILD_ENV=GOARCH=amd64 GOOS=darwin | ||
bin/fc-yang-$(VER)-windows-amd64: BUILD_ENV=GOARCH=amd64 GOOS=windows | ||
bin/fc-yang-$(VER)-windows-amd64: BIN_EXT=.exe | ||
bin/fc-yang-$(VER)-linux-amd64: BUILD_ENV=GOARCH=amd64 GOOS=linux | ||
|
||
.PHONY: $(BIN_TARGETS) | ||
|
||
$(BIN_TARGETS): | ||
test -d $(dir $@) || mkdir -p $(dir $@) | ||
$(BUILD_ENV) go build $(BUILD_OPTS) -o $@$(BIN_EXT) cmd/fc-yang/main.go | ||
|
||
|
||
# Getting this error. Might have been introduced in 1.20 and no known solution or workaround | ||
# https://github.com/golang/go/issues/45361 | ||
test-coverage: | ||
go test -coverprofile test-coverage.out ./... | ||
go tool cover -html=test-coverage.out -o test-coverage.html | ||
go tool cover -func test-coverage.out | ||
|