2021-10-06 01:05:22 +02:00
|
|
|
# https://taskfile.dev
|
|
|
|
|
|
|
|
version: '3'
|
|
|
|
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
|
|
|
|
|
|
vars:
|
|
|
|
DOCKER: '{{default "docker" .DOCKER}}'
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
dev:
|
2021-10-06 01:20:23 +02:00
|
|
|
desc: Setup git hooks
|
2021-10-06 01:05:22 +02:00
|
|
|
cmds:
|
|
|
|
- cp -f scripts/pre-commit.sh .git/hooks/pre-commit
|
|
|
|
|
|
|
|
setup:
|
|
|
|
desc: Install dependencies
|
|
|
|
cmds:
|
|
|
|
- go mod tidy
|
|
|
|
|
|
|
|
build:
|
|
|
|
desc: Build the binary
|
2021-10-06 04:23:19 +02:00
|
|
|
sources:
|
|
|
|
- ./**/*.go
|
|
|
|
generates:
|
|
|
|
- ./goreleaser
|
2021-10-06 01:05:22 +02:00
|
|
|
cmds:
|
|
|
|
- go build
|
|
|
|
|
|
|
|
test:
|
|
|
|
desc: Run tests
|
|
|
|
env:
|
|
|
|
LC_ALL: C
|
|
|
|
vars:
|
|
|
|
TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}'
|
2021-10-06 01:22:26 +02:00
|
|
|
SOURCE_FILES: '{{default "./..." .SOURCE_FILES}}'
|
2021-10-06 01:05:22 +02:00
|
|
|
TEST_PATTERN: '{{default "." .TEST_PATTERN}}'
|
|
|
|
cmds:
|
|
|
|
- go test {{.TEST_OPTIONS}} -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -run {{.TEST_PATTERN}} -timeout=5m
|
|
|
|
|
|
|
|
cover:
|
2021-10-06 01:20:23 +02:00
|
|
|
desc: Open the cover tool
|
2021-10-06 01:05:22 +02:00
|
|
|
cmds:
|
|
|
|
- go tool cover -html=coverage.txt
|
|
|
|
|
|
|
|
fmt:
|
2021-10-06 01:20:23 +02:00
|
|
|
desc: gofumpt all code
|
2021-10-06 01:05:22 +02:00
|
|
|
cmds:
|
|
|
|
- gofumpt -w -l -s .
|
|
|
|
|
2021-11-07 04:22:51 +02:00
|
|
|
lint:
|
|
|
|
desc: Lint the code with golangci-lint
|
|
|
|
cmds:
|
2021-11-21 16:10:54 +02:00
|
|
|
- golangci-lint run ./...
|
2021-11-07 04:22:51 +02:00
|
|
|
|
2021-10-06 01:05:22 +02:00
|
|
|
ci:
|
2021-10-06 01:39:24 +02:00
|
|
|
desc: Run all CI steps
|
2021-10-06 13:07:40 +02:00
|
|
|
cmds:
|
|
|
|
- task: setup
|
|
|
|
- task: build
|
|
|
|
- task: test
|
|
|
|
|
|
|
|
default:
|
|
|
|
desc: Runs the default tasks
|
|
|
|
cmds:
|
|
|
|
- task: ci
|
2021-10-06 01:05:22 +02:00
|
|
|
|
2021-11-18 15:01:31 +02:00
|
|
|
schema:generate:
|
|
|
|
desc: Generate JSONSchema
|
|
|
|
cmds:
|
|
|
|
- go run . schema -o ./www/docs/static/schema.json
|
|
|
|
sources:
|
|
|
|
- pkg/config/config.go
|
|
|
|
generates:
|
|
|
|
- ./www/docs/static/schema.json
|
|
|
|
|
2021-10-10 16:16:03 +02:00
|
|
|
docs:generate:
|
|
|
|
desc: Generate docs
|
|
|
|
cmds:
|
|
|
|
- cp -rf CONTRIBUTING.md www/docs/contributing.md
|
2021-10-30 14:43:54 +02:00
|
|
|
- cp -rf USERS.md www/docs/users.md
|
2021-10-10 16:16:03 +02:00
|
|
|
sources:
|
|
|
|
- CONTRIBUTING.md
|
2021-10-30 14:43:54 +02:00
|
|
|
- USERS.md
|
2021-10-10 16:16:03 +02:00
|
|
|
generates:
|
|
|
|
- www/docs/contributing.md
|
2021-10-30 14:43:54 +02:00
|
|
|
- www/docs/users.md
|
2021-10-10 16:16:03 +02:00
|
|
|
|
2021-10-06 01:20:23 +02:00
|
|
|
docs:imgs:
|
2021-10-06 01:05:22 +02:00
|
|
|
desc: Download and resize images
|
|
|
|
cmds:
|
2021-10-27 03:41:33 +02:00
|
|
|
- wget -O www/docs/static/logo.png https://raw.githubusercontent.com/goreleaser/artwork/master/goreleaserfundo.png
|
|
|
|
- wget -O www/docs/static/card.png https://raw.githubusercontent.com/goreleaser/artwork/master/twitter-card.png
|
2021-10-06 01:05:22 +02:00
|
|
|
- wget -O www/docs/static/avatar.png https://github.com/goreleaser.png
|
2021-10-06 01:46:59 +02:00
|
|
|
- convert www/docs/static/avatar.png -define icon:auto-resize=64,48,32,16 www/docs/static/favicon.ico
|
2021-10-06 01:05:22 +02:00
|
|
|
- convert www/docs/static/avatar.png -resize x120 www/docs/static/apple-touch-icon.png
|
|
|
|
|
|
|
|
docs:serve:
|
|
|
|
desc: Start documentation server
|
|
|
|
cmds:
|
2021-10-10 16:16:03 +02:00
|
|
|
- task: docs:generate
|
2021-11-14 17:27:43 +02:00
|
|
|
- '{{.DOCKER}} run --rm -p 8000:8000 -v ${PWD}/www:/docs docker.io/squidfunk/mkdocs-material'
|
2021-10-06 01:05:22 +02:00
|
|
|
|
2021-10-10 16:23:33 +02:00
|
|
|
docs:build:
|
|
|
|
desc: Build docs
|
|
|
|
cmds:
|
2021-10-10 16:24:55 +02:00
|
|
|
- task: docs:generate
|
2021-10-12 21:51:24 +02:00
|
|
|
- '{{.DOCKER}} run --rm -v ${PWD}/www:/docs docker.io/squidfunk/mkdocs-material build'
|
2021-10-10 16:23:33 +02:00
|
|
|
|
2021-10-06 01:20:23 +02:00
|
|
|
docs:vercel:build:
|
|
|
|
desc: Build documentation for deploying to Vercel
|
2021-10-06 01:05:22 +02:00
|
|
|
cmds:
|
2021-10-06 01:20:23 +02:00
|
|
|
- scripts/vercel/install.sh
|
|
|
|
- scripts/vercel/build.sh
|
2021-10-06 04:23:19 +02:00
|
|
|
|
|
|
|
release:
|
|
|
|
desc: Create a new tag
|
|
|
|
vars:
|
|
|
|
NEXT:
|
|
|
|
sh: svu n
|
|
|
|
cmds:
|
|
|
|
- git tag {{.NEXT}}
|
|
|
|
- echo {{.NEXT}}
|
|
|
|
- git push origin --tags
|
|
|
|
|
2021-11-22 01:34:42 +02:00
|
|
|
goreleaser:test:pkg:
|
|
|
|
desc: Test a package
|
|
|
|
cmds:
|
|
|
|
- docker run --platform linux/{{.Platform}} --rm --workdir /tmp -v $PWD/dist:/tmp {{.Image}} sh -c '{{.Cmd}} && goreleaser --version'
|
|
|
|
|
2021-11-14 03:23:11 +02:00
|
|
|
goreleaser:test:rpm:
|
|
|
|
desc: Tests rpm packages
|
2021-11-22 01:34:42 +02:00
|
|
|
vars:
|
|
|
|
rpm: 'rpm --nodeps -ivh'
|
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: '386'
|
|
|
|
Image: centos:centos7
|
|
|
|
Cmd: '{{.rpm}} goreleaser-*.i386.rpm'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'amd64'
|
|
|
|
Image: fedora
|
|
|
|
Cmd: '{{.rpm}} goreleaser-*.x86_64.rpm'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm64'
|
|
|
|
Image: fedora
|
|
|
|
Cmd: '{{.rpm}} goreleaser-*.aarch64.rpm'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm/6'
|
|
|
|
Image: fedora
|
|
|
|
Cmd: '{{.rpm}} goreleaser-*.armv6hl.rpm'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm/7'
|
|
|
|
Image: fedora
|
|
|
|
Cmd: '{{.rpm}} goreleaser-*.armv7hl.rpm'
|
2021-11-14 03:23:11 +02:00
|
|
|
|
|
|
|
goreleaser:test:deb:
|
|
|
|
desc: Tests rpm packages
|
2021-11-22 01:34:42 +02:00
|
|
|
vars:
|
|
|
|
dpkg: 'dpkg --ignore-depends=git -i'
|
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'amd64'
|
|
|
|
Image: ubuntu
|
|
|
|
Cmd: '{{.dpkg}} goreleaser*_amd64.deb'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm64'
|
|
|
|
Image: ubuntu
|
|
|
|
Cmd: '{{.dpkg}} goreleaser*_arm64.deb'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm/6'
|
|
|
|
Image: debian
|
|
|
|
Cmd: '{{.dpkg}} goreleaser*_armel.deb'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm/7'
|
|
|
|
Image: ubuntu
|
|
|
|
Cmd: '{{.dpkg}} goreleaser*_armhf.deb'
|
2021-11-14 03:23:11 +02:00
|
|
|
|
|
|
|
goreleaser:test:apk:
|
|
|
|
desc: Tests rpm packages
|
2021-11-22 01:34:42 +02:00
|
|
|
vars:
|
|
|
|
apk: 'apk add --allow-untrusted -U'
|
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: '386'
|
|
|
|
Image: alpine
|
|
|
|
Cmd: '{{.apk}} goreleaser*_x86.apk'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'amd64'
|
|
|
|
Image: alpine
|
|
|
|
Cmd: '{{.apk}} goreleaser*_x86_64.apk'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm64'
|
|
|
|
Image: alpine
|
|
|
|
Cmd: '{{.apk}} goreleaser*_aarch64.apk'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm/6'
|
|
|
|
Image: alpine
|
|
|
|
Cmd: '{{.apk}} goreleaser*_armhf.apk'
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
|
|
|
Platform: 'arm/7'
|
|
|
|
Image: alpine
|
|
|
|
Cmd: '{{.apk}} goreleaser*_armv7.apk'
|
2021-11-14 03:23:11 +02:00
|
|
|
|
|
|
|
goreleaser:test:
|
2021-11-22 01:34:42 +02:00
|
|
|
desc: Test built linux packages
|
2021-11-14 03:23:11 +02:00
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:apk
|
|
|
|
- task: goreleaser:test:deb
|
|
|
|
- task: goreleaser:test:rpm
|
|
|
|
|
2021-10-06 04:23:19 +02:00
|
|
|
goreleaser:
|
|
|
|
desc: Run GoReleaser either in snapshot or release mode
|
|
|
|
deps:
|
|
|
|
- build
|
|
|
|
vars:
|
|
|
|
SNAPSHOT:
|
|
|
|
sh: 'if [[ $GITHUB_REF != refs/tags/v* ]]; then echo "--snapshot"; fi'
|
|
|
|
cmds:
|
|
|
|
- ./goreleaser release --rm-dist {{.SNAPSHOT}}
|