mirror of
https://github.com/Lifailon/lazyjournal.git
synced 2026-11-11 01:09:46 +01:00
add make for build and tests
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# Get version from flag in source code
|
||||
version := $(shell go run main.go -v)
|
||||
|
||||
prep:
|
||||
@go fmt ./... # Formatting code
|
||||
@go vet ./... # Analyzing code for errors
|
||||
@go get ./... # Download all dependencies from go.mod
|
||||
@go mod tidy # Removal of unused and installing missing dependencies
|
||||
@go mod verify # Checking dependencies
|
||||
@go build -v ./... # Checking code compilation
|
||||
|
||||
update: prep
|
||||
go get -u ./...
|
||||
|
||||
install-lint:
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
go install github.com/go-critic/go-critic/cmd/gocritic@latest
|
||||
go install github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
|
||||
lint: prep install-lint
|
||||
golangci-lint run ./main.go
|
||||
gocritic check -enableAll ./main.go
|
||||
gosec -severity=high ./...
|
||||
|
||||
list:
|
||||
@go test -list . ./...
|
||||
|
||||
# make test-run n=TestMain
|
||||
test: prep
|
||||
go test -run $(n) ./...
|
||||
|
||||
build: prep
|
||||
@echo "Build version: $(version)"
|
||||
GOOS=linux GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-linux-amd64
|
||||
GOOS=linux GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-linux-arm64
|
||||
GOOS=darwin GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-darwin-amd64
|
||||
GOOS=darwin GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-darwin-arm64
|
||||
GOOS=openbsd GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-openbsd-amd64
|
||||
GOOS=openbsd GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-openbsd-arm64
|
||||
GOOS=freebsd GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-freebsd-amd64
|
||||
GOOS=freebsd GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-freebsd-arm64
|
||||
GOOS=windows GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-windows-amd64
|
||||
GOOS=windows GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-windows-arm64
|
||||
Reference in New Issue
Block a user