leverage makefile to run build tasks (#976)

remove circle ci
This commit is contained in:
Joshua Harshman 2020-02-20 12:25:38 -07:00 committed by GitHub
parent 3c2624538b
commit 39cf99f556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 66 deletions

View File

@ -1,53 +0,0 @@
version: 2
references:
workspace: &workspace
/go/src/github.com/spf13/cobra
run_tests: &run_tests
run:
name: "All Commands"
command: |
mkdir -p bin
curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck
chmod +x bin/shellcheck
go get -t -v ./...
PATH=$PATH:$PWD/bin go test -v ./...
go build
if [ -z $NOVET ]; then
diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
fi
jobs:
go-current:
docker:
- image: circleci/golang:1.12
working_directory: *workspace
steps:
- checkout
- *run_tests
- run:
name: "Check formatting"
command: diff -u <(echo -n) <(gofmt -d -s .)
go-previous:
docker:
- image: circleci/golang:1.11
working_directory: *workspace
steps:
- checkout
- *run_tests
go-latest:
docker:
- image: circleci/golang:latest
working_directory: *workspace
steps:
- checkout
- *run_tests
workflows:
version: 2
main:
jobs:
- go-current
- go-previous
- go-latest

2
.gitignore vendored
View File

@ -32,8 +32,8 @@ Session.vim
tags tags
*.exe *.exe
cobra
cobra.test cobra.test
bin
.idea/ .idea/
*.iml *.iml

View File

@ -3,26 +3,27 @@ language: go
stages: stages:
- diff - diff
- test - test
- build
go: go:
- 1.10.x
- 1.11.x
- 1.12.x - 1.12.x
- 1.13.x
- tip - tip
before_install:
- go get -u github.com/kyoh86/richgo
- go get -u github.com/mitchellh/gox
matrix: matrix:
allow_failures: allow_failures:
- go: tip - go: tip
include: include:
- stage: diff - stage: diff
go: 1.12.x go: 1.13.x
script: diff -u <(echo -n) <(gofmt -d -s .) script: make fmt
- stage: build
before_install: go get -u github.com/kyoh86/richgo go: 1.13.x
script: make cobra_generator
script: script:
- richgo test -v ./... - make test
- go build
- if [ -z $NOVET ]; then
diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
fi

36
Makefile Normal file
View File

@ -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
cobra/Makefile Normal file
View File

@ -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}} \
;