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

Add Makefile to project #976

Merged
merged 1 commit into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 0 additions & 53 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Session.vim
tags

*.exe
cobra
cobra.test
bin

.idea/
*.iml
25 changes: 13 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@ language: go
stages:
- diff
- test
- build

go:
- 1.10.x
- 1.11.x
- 1.12.x
- 1.13.x
- tip

before_install:
- go get -u github.com/kyoh86/richgo
- go get -u github.com/mitchellh/gox

matrix:
allow_failures:
- go: tip
include:
- stage: diff
go: 1.12.x
script: diff -u <(echo -n) <(gofmt -d -s .)

before_install: go get -u github.com/kyoh86/richgo
go: 1.13.x
script: make fmt
- stage: build
go: 1.13.x
script: make cobra_generator

script:
- richgo test -v ./...
- go build
- if [ -z $NOVET ]; then
diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
fi
script:
- make test
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
BIN="./bin"
SRC=$(shell find . -name "*.go")

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

.PHONY: fmt vet test cobra_generator install_deps clean

default: all

all: fmt vet test cobra_generator

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

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

cobra_generator: install_deps
$(info ******************** building generator ********************)
mkdir -p $(BIN)
make -C cobra all

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

vet:
$(info ******************** vetting ********************)
go vet ./...

clean:
rm -rf $(BIN)
23 changes: 23 additions & 0 deletions cobra/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
XC_OS="linux darwin"
jharshman marked this conversation as resolved.
Show resolved Hide resolved
XC_ARCH="amd64"
XC_PARALLEL="2"
BIN="../bin"
SRC=$(shell find . -name "*.go")

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

.PHONY: all build

default: all

all: build

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