mirror of
https://github.com/Lifailon/lazyjournal.git
synced 2026-11-11 01:09:46 +01:00
add go-task for build and etc
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
prep:
|
||||
desc: "Install dependencies and code preparation"
|
||||
cmds:
|
||||
- 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:
|
||||
desc: "Update dependencies"
|
||||
cmds:
|
||||
- task: prep
|
||||
- go get -u ./...
|
||||
|
||||
install:
|
||||
desc: "Install dependencies for linter checks"
|
||||
cmds:
|
||||
- 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
|
||||
|
||||
linter:
|
||||
desc: "Linter checks"
|
||||
cmds:
|
||||
- task: install
|
||||
- golangci-lint run ./main.go
|
||||
- gocritic check -enableAll ./main.go
|
||||
- gosec -severity=high ./...
|
||||
|
||||
test:
|
||||
desc: "Run unit test in Linux"
|
||||
cmds:
|
||||
- |
|
||||
{{if eq OS "windows"}}
|
||||
go test -v --run "TestWin*|TestFlags|TestMainInterface" -cover
|
||||
{{else if eq OS "darwin"}}
|
||||
sudo go test -v --run "TestUnixFiles|TestFlags|TestMainInterface" -cover
|
||||
{{else}}
|
||||
sudo go test -v -cover
|
||||
{{end}}
|
||||
|
||||
mac:
|
||||
desc: "Run unit test in macOS"
|
||||
cmds:
|
||||
- sudo go test -v --run "TestUnixFiles|TestFlags|TestMainInterface" -cover
|
||||
|
||||
win:
|
||||
desc: "Run unit test in Windows"
|
||||
cmds:
|
||||
- go test -v --run "TestWin*|TestFlags|TestMainInterface" -cover
|
||||
|
||||
interface:
|
||||
desc: "Run test interface"
|
||||
cmds:
|
||||
- go test -v --run "TestM.*" -cover
|
||||
|
||||
build:
|
||||
desc: "Build"
|
||||
vars:
|
||||
VERSION:
|
||||
sh: go run main.go -v # Get version from flag in source code
|
||||
cmds:
|
||||
- task: prep
|
||||
- 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