Skip to content

Commit

Permalink
leverage makefile to run build tasks (#976)
Browse files Browse the repository at this point in the history
remove circle ci
  • Loading branch information
jharshman committed Feb 20, 2020
1 parent 3c26245 commit 39cf99f
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 66 deletions.
53 changes: 0 additions & 53 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -32,8 +32,8 @@ Session.vim
tags

*.exe
cobra
cobra.test
bin

.idea/
*.iml
25 changes: 13 additions & 12 deletions .travis.yml
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
@@ -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
@@ -0,0 +1,23 @@
XC_OS="linux darwin"
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}} \
;

0 comments on commit 39cf99f

Please sign in to comment.