1
0
mirror of https://github.com/go-task/task.git synced 2024-12-12 10:45:49 +02:00
task/Taskfile.yml

187 lines
4.7 KiB
YAML
Raw Permalink Normal View History

2019-07-07 19:18:02 +02:00
version: '3'
2018-03-04 21:20:26 +02:00
includes:
website:
aliases: [w, docs, d]
taskfile: ./website
dir: ./website
vars:
BIN: "{{.ROOT_DIR}}/bin"
env:
CGO_ENABLED: '0'
2018-03-04 21:20:26 +02:00
tasks:
2018-07-15 20:42:46 +02:00
default:
cmds:
- task: lint
2018-07-15 20:42:46 +02:00
- task: test
2018-03-04 21:20:26 +02:00
install:
desc: Installs Task
2022-10-15 00:28:27 +02:00
aliases: [i]
sources:
- './**/*.go'
2018-03-04 21:20:26 +02:00
cmds:
- go install -v ./cmd/task
2018-03-04 21:20:26 +02:00
generate:
2024-09-08 00:31:01 +02:00
desc: Runs Mockery to create mocks
aliases: [gen, g]
deps: [install:mockery]
sources:
- "internal/fingerprint/checker.go"
generates:
- "internal/mocks/*.go"
cmds:
- "{{.BIN}}/mockery --dir ./internal/fingerprint --name SourcesCheckable"
- "{{.BIN}}/mockery --dir ./internal/fingerprint --name StatusCheckable"
install:mockery:
desc: Installs mockgen; a tool to generate mock files
vars:
MOCKERY_VERSION: v2.24.0
env:
GOBIN: "{{.BIN}}"
status:
- go version -m {{.BIN}}/mockery | grep github.com/vektra/mockery | grep {{.MOCKERY_VERSION}}
cmds:
- go install github.com/vektra/mockery/v2@{{.MOCKERY_VERSION}}
mod:
desc: Downloads and tidy Go modules
cmds:
- go mod download
- go mod tidy
2018-03-04 21:20:26 +02:00
clean:
desc: Cleans temp files and folders
2024-09-08 00:31:01 +02:00
aliases: [clear]
2018-03-04 21:20:26 +02:00
cmds:
- rm -rf dist/
- rm -rf tmp/
2018-03-04 21:20:26 +02:00
lint:
desc: Runs golangci-lint
2022-10-15 00:28:27 +02:00
aliases: [l]
sources:
- './**/*.go'
2022-12-17 16:02:17 +02:00
- .golangci.yml
cmds:
- golangci-lint run
2023-03-31 21:13:29 +02:00
lint:fix:
desc: Runs golangci-lint and fixes any issues
sources:
- './**/*.go'
- .golangci.yml
cmds:
- golangci-lint run --fix
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
2018-03-04 21:20:26 +02:00
test:
desc: Runs test suite
2022-10-15 00:28:27 +02:00
aliases: [t]
deps: [install]
2018-03-04 21:20:26 +02:00
cmds:
2018-07-15 20:42:46 +02:00
- go test {{catLines .GO_PACKAGES}}
vars:
GO_PACKAGES:
sh: go list ./...
2018-03-04 21:20:26 +02:00
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 ./...
goreleaser:test:
2018-03-04 21:20:26 +02:00
desc: Tests release process without publishing
cmds:
2023-08-10 03:50:07 +02:00
- goreleaser --snapshot --clean
2018-03-04 21:20:26 +02:00
goreleaser:install:
desc: Installs goreleaser
cmds:
- go install github.com/goreleaser/goreleaser/v2@latest
2024-05-13 16:37:07 +02:00
release:*:
2023-03-26 17:32:20 +02:00
desc: Prepare the project for a new release
2024-05-13 16:37:07 +02:00
summary: |
This task will do the following:
- Update the version and date in the CHANGELOG.md file
- Update the version in the package.json and package-lock.json files
- Copy the latest docs to the "current" version on the website
- Commit the changes
- Create a new tag
- Push the commit/tag to the repository
- Create a GitHub release
To use the task, simply run "task release:<version>" where "<version>" is is one of:
- "major" - Bumps the major number
- "minor" - Bumps the minor number
- "patch" - Bumps the patch number
- A semver compatible version number (e.g. "1.2.3")
vars:
VERSION:
sh: "go run ./cmd/release --version {{index .MATCH 0}}"
COMPLETE_MESSAGE: |
Creating release with GoReleaser: https://github.com/go-task/task/actions/workflows/release.yml
Please wait for the CI to finish and then do the following:
- Copy the changelog for v{{.VERSION}} to the GitHub release
- Publish the package to NPM with `task npm:publish`
- Update and push the snapcraft manifest in https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml
preconditions:
- sh: test $(git rev-parse --abbrev-ref HEAD) = "main"
msg: "You must be on the main branch to release"
- sh: "[[ -z $(git diff --shortstat main) ]]"
msg: "You must have a clean working tree to release"
prompt: "Are you sure you want to release version {{.VERSION}}?"
cmds:
- cmd: echo "Releasing v{{.VERSION}}"
silent: true
- "go run ./cmd/release {{.VERSION}}"
- "git add --all"
- "git commit -m v{{.VERSION}}"
- "git push"
- "git tag v{{.VERSION}}"
- "git push origin tag v{{.VERSION}}"
- cmd: printf "%s" '{{.COMPLETE_MESSAGE}}'
silent: true
2022-09-09 02:21:39 +02:00
npm:publish:
desc: Publish release to npm
cmds:
- npm publish --access=public
2018-07-15 20:42:46 +02:00
packages:
cmds:
- echo '{{.GO_PACKAGES}}'
vars:
GO_PACKAGES:
sh: go list ./...
2018-07-15 20:42:46 +02:00
silent: true