Initial Changes

This commit is contained in:
Alec Sears
2019-10-10 14:32:20 -05:00
parent e8c5c0c3b9
commit e3e6c1512b
4 changed files with 60 additions and 8 deletions

View File

@@ -1,7 +1,43 @@
all: frontend backend
all: install build test lint
frontend:
yarn dev-build
# Install dependencies
install:
# Frontend
yarn install --pure-lockfile
# Backend
go mod vendor
GO111MODULE=off go get -u golang.org/x/lint/golint
backend:
go build -o ./dist/zabbix-plugin_linux_amd64 ./pkg
build: build-frontend build-backend
build-frontend:
npm run dev-build
build-backend:
env GOOS=linux go build -o -mod=vendor ./dist/zabbix-plugin_linux_amd64 ./pkg
dist: dist-frontend dist-backend
dist-frontend:
npm run build
dist-backend: dist-backend-linux dist-backend-darwin dist-backend-windows
dist-backend-windows: extension = .exe
dist-backend-%:
$(eval filename = zabbix-plugin_$*_amd64$(extension))
env GOOS=$* GOARCH=amd64 go build -ldflags="-s -w" -mod=vendor -o ./dist/$(filename) ./pkg
.PHONY: test
test: test-frontend test-backend
test-frontend:
npm run test
test-backend:
go test -v -mod=vendor ./...
test-ci:
npm run ci-test
go test -race -coverprofile=coverage.txt -covermode=atomic -mod=vendor
.PHONY: clean
clean:
-rm -r ./dist/
.PHONY: lint
lint:
npm run lint
golint pkg/...