1
0
mirror of https://github.com/go-task/task.git synced 2025-01-08 04:04:08 +02:00
task/Taskfile.yml
Andrey Nering 4b23d63d39 v3.23.0
2023-03-26 21:42:46 -03:00

130 lines
2.8 KiB
YAML

version: '3'
includes:
docs:
aliases: [d]
taskfile: ./docs
dir: ./docs
env:
CGO_ENABLED: '0'
tasks:
default:
cmds:
- task: lint
- task: test
install:
desc: Installs Task
aliases: [i]
sources:
- './**/*.go'
cmds:
- go install -v ./cmd/task
generate:
desc: Runs Go generate to create mocks
aliases: [gen, g]
deps: [install:mockgen]
sources:
- "internal/fingerprint/checker.go"
generates:
- "internal/fingerprint/checker_mock.go"
cmds:
- mockgen -source=internal/fingerprint/checker.go -destination=internal/fingerprint/checker_mock.go -package=fingerprint
install:mockgen:
desc: Installs mockgen; a tool to generate mock files
status:
- command -v mockgen &>/dev/null
cmds:
- go install github.com/golang/mock/mockgen@latest
mod:
desc: Downloads and tidy Go modules
cmds:
- go mod download
- go mod tidy
clean:
desc: Cleans temp files and folders
cmds:
- rm -rf dist/
- rm -rf tmp/
lint:
desc: Runs golangci-lint
aliases: [l]
sources:
- './**/*.go'
- .golangci.yml
cmds:
- golangci-lint run
sleepit:build:
desc: Builds the sleepit test helper
sources:
- ./cmd/sleepit/**/*.go
generates:
- ./bin/sleepit
cmds:
- go build -o ./bin/sleepit{{exeExt}} ./cmd/sleepit
sleepit:run:
desc: Builds the sleepit test helper
deps: [sleepit:build]
cmds:
- ./bin/sleepit {{.CLI_ARGS}}
silent: true
test:
desc: Runs test suite
aliases: [t]
deps: [install]
cmds:
- go test {{catLines .GO_PACKAGES}}
vars:
GO_PACKAGES:
sh: go list ./...
test:all:
desc: Runs test suite with signals and watch tests included
deps: [install, sleepit:build]
cmds:
- go test {{catLines .GO_PACKAGES}} -tags 'signals watch'
vars:
GO_PACKAGES:
sh: go list ./...
test-release:
desc: Tests release process without publishing
cmds:
- goreleaser --snapshot --rm-dist
release:
desc: Prepare the project for a new release
cmds:
- go run ./cmd/release {{.CLI_ARGS}}
npm:bump:
desc: Bump version in package.json. Requires `jq`.
vars:
VERSION: '{{coalesce .CLI_ARGS .VERSION}}'
cmds:
- cat package.json | jq '.version = "{{.VERSION}}"' > temp.json; mv temp.json package.json
- cat package-lock.json | jq '.version = "{{.VERSION}}" | .packages."".version = "{{.VERSION}}"' > temp.json; mv temp.json package-lock.json
npm:publish:
desc: Publish release to npm
cmds:
- npm publish --access=public
packages:
cmds:
- echo '{{.GO_PACKAGES}}'
vars:
GO_PACKAGES:
sh: go list ./...
silent: true