Skip to content

Commit

Permalink
Add fmt, lint, test make targets
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Liggitt <liggitt@google.com>
  • Loading branch information
liggitt committed Feb 10, 2022
1 parent 7ab21cf commit c90e947
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
16 changes: 0 additions & 16 deletions .github/labeler.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/labeler.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
go install github.com/kyoh86/richgo"${_version}"
go install github.com/mitchellh/gox"${_version}"
- run: PATH=$HOME/go/bin/:$PATH make test cobra_generator
- run: PATH=$HOME/go/bin/:$PATH make test build

test-win:
name: MINGW64
Expand Down Expand Up @@ -97,4 +97,4 @@ jobs:
go install github.com/kyoh86/richgo@latest
go install github.com/mitchellh/gox@latest
- run: PATH=$HOME/go/bin:$PATH make test cobra_generator
- run: PATH=$HOME/go/bin:$PATH make test build
35 changes: 31 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,50 @@
XC_OS="linux darwin"
XC_ARCH="amd64"
XC_PARALLEL="2"
BIN="../bin"
BIN="bin"
SRC=$(shell find . -name "*.go")

ifeq (, $(shell which golangci-lint))
$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
endif

ifeq (, $(shell which richgo))
$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo")
endif

ifeq (, $(shell which gox))
$(warning "could not find gox in $(PATH), run: go get github.com/mitchellh/gox")
endif

.PHONY: all build
.PHONY: all build fmt lint test install_deps clean

default: all

all: build
all: fmt test build

build:
build: install_deps
gox \
-os=$(XC_OS) \
-arch=$(XC_ARCH) \
-parallel=$(XC_PARALLEL) \
-output=$(BIN)/{{.Dir}}_{{.OS}}_{{.Arch}} \
;

fmt:
$(info ******************** checking formatting ********************)
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)

lint:
$(info ******************** running lint tools ********************)
golangci-lint run -v

test: install_deps
$(info ******************** running tests ********************)
richgo test -v ./...

install_deps:
$(info ******************** downloading dependencies ********************)
go get -v ./...

clean:
rm -rf $(BIN)

0 comments on commit c90e947

Please sign in to comment.