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
*.exe
cobra
cobra.test
bin
.idea/
*.iml

View file

@ -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 .)
go: 1.13.x
script: make fmt
- stage: build
go: 1.13.x
script: make cobra_generator
before_install: go get -u github.com/kyoh86/richgo
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
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}} \
;