Files
grafana-zabbix/Makefile
Alexander Zobnin e3e896742b Build plugin with grafana toolkit (#1539)
* Use grafana toolkit template for building plugin

* Fix linter and type errors

* Update styles building

* Fix sass deprecation warning

* Remove empty js files produced by webpack building sass

* Fix signing script

* Replace classnames with cx

* Fix data source config page

* Use custom webpack config instead of overriding original one

* Use gpx_ prefix for plugin executable

* Remove unused configs

* Roll back react hooks dependencies usage

* Move plugin-specific ts config to root config file

* Temporary do not use rst2html for function description tooltip

* Remove unused code

* remove unused dependencies

* update react table dependency

* Migrate tests to typescript

* remove unused dependencies

* Remove old webpack configs

* Add sign target to makefile

* Add magefile

* Update CI test job

* Update go packages

* Update build instructions

* Downgrade go version to 1.18

* Fix go version in ci

* Fix metric picker

* Add comment to webpack config

* remove angular mocks

* update bra config

* Rename datasource-zabbix to datasource (fix mage build)

* Add instructions for building backend with mage

* Fix webpack targets

* Fix ci backend tests

* Add initial e2e tests

* Fix e2e ci tests

* Update docker compose for cypress tests

* build grafana docker image

* Fix docker stop task

* CI: add Grafana compatibility check
2022-12-09 14:14:34 +03:00

85 lines
2.3 KiB
Makefile

all: install build test lint
# Install dependencies
install:
# Frontend
yarn install --pure-lockfile
# Backend
go install -v ./pkg/
GO111MODULE=off go get -u golang.org/x/lint/golint
deps-go:
go install -v ./pkg/
build: build-frontend build-backend
build-frontend:
yarn build
build-backend:
mage -v build:backend
build-debug:
env GOOS=linux go build -gcflags="all=-N -l" -o ./dist/gpx_zabbix-plugin_linux_amd64 ./pkg
# Build for specific platform
build-backend-windows: extension = .exe
build-backend-%-arm64:
$(eval filename = gpx_zabbix-plugin_$*_arm64$(extension))
env GOOS=$* GOARCH=arm64 go build -o ./dist/$(filename) ./pkg
build-backend-%:
$(eval filename = gpx_zabbix-plugin_$*_amd64$(extension))
env GOOS=$* GOARCH=amd64 go build -o ./dist/$(filename) ./pkg
run-frontend:
yarn install --pure-lockfile
yarn dev
run-backend:
# Rebuilds plugin on changes and kill running instance which forces grafana to restart plugin
# See .bra.toml for bra configuration details
bra run
# Build plugin for all platforms (ready for distribution)
dist: dist-frontend dist-backend
dist-frontend:
yarn build
dist-backend: dist-backend-linux dist-backend-darwin dist-backend-freebsd dist-backend-windows dist-arm
dist-backend-windows: extension = .exe
dist-backend-%:
$(eval filename = gpx_zabbix-plugin_$*_amd64$(extension))
env GOOS=$* GOARCH=amd64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg
# ARM
dist-arm: dist-arm-linux-arm-v6 dist-arm-linux-arm64 dist-arm-darwin-arm64 dist-arm-freebsd-arm64
dist-arm-linux-arm-v6:
env GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg
dist-arm-linux-arm-v7:
env GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg
dist-arm-%-arm64:
$(eval filename = gpx_zabbix-plugin_$*_arm64$(extension))
env GOOS=$* GOARCH=arm64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg
.PHONY: test
test: test-frontend test-backend
test-frontend:
yarn test
test-backend:
go test ./pkg/...
test-ci:
yarn ci-test
mkdir -p tmp/coverage/golang/
go test -race -coverprofile=tmp/coverage/golang/coverage.txt -covermode=atomic ./pkg/...
.PHONY: clean
clean:
-rm -r ./dist/
.PHONY: lint
lint:
yarn lint
golint -min_confidence=1.1 -set_exit_status pkg/...
sign-package:
yarn sign
package: install dist sign-package