2021-10-06 01:05:22 +02:00
|
|
|
# https://taskfile.dev
|
|
|
|
|
2023-06-14 04:25:18 +02:00
|
|
|
version: "3"
|
2021-10-06 01:05:22 +02:00
|
|
|
|
|
|
|
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:
|
2021-11-23 19:38:26 +02:00
|
|
|
- gofumpt -w -l .
|
2021-10-06 01:05:22 +02:00
|
|
|
|
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
|
2022-05-03 01:30:19 +02:00
|
|
|
- cp -rf EULA.md www/docs/eula.md
|
2022-11-08 05:05:36 +02:00
|
|
|
- cp -rf SECURITY.md www/docs/security.md
|
2021-10-10 16:16:03 +02:00
|
|
|
sources:
|
|
|
|
- CONTRIBUTING.md
|
2021-10-30 14:43:54 +02:00
|
|
|
- USERS.md
|
2022-05-03 01:30:19 +02:00
|
|
|
- EULA.md
|
2022-11-08 05:05:36 +02:00
|
|
|
- SECURITY.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
|
2022-05-03 01:30:19 +02:00
|
|
|
- www/docs/eula.md
|
2022-11-08 05:05:36 +02:00
|
|
|
- www/docs/security.md
|
2021-10-10 16:16:03 +02:00
|
|
|
|
2022-12-29 19:55:45 +02:00
|
|
|
docs:releases:
|
2022-12-30 02:57:42 +02:00
|
|
|
desc: Generate releases.json and latest files
|
2022-12-29 19:55:45 +02:00
|
|
|
cmds:
|
|
|
|
- ./scripts/get-releases.sh
|
|
|
|
generates:
|
|
|
|
- www/docs/static/releases.json
|
|
|
|
- www/docs/static/releases-pro.json
|
|
|
|
- www/docs/static/latest
|
|
|
|
- www/docs/static/latest-pro
|
|
|
|
|
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
|
2023-06-14 04:25:18 +02:00
|
|
|
- "{{.DOCKER}} build -t mkdocs -f www/docker/Dockerfile www/docker"
|
|
|
|
- "{{.DOCKER}} run --rm -p 8000:8000 -v ${PWD}/www:/docs mkdocs"
|
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
|
2023-06-15 05:03:13 +02:00
|
|
|
- "{{.DOCKER}} build -t mkdocs -f www/docker/Dockerfile www/docker"
|
2023-06-15 05:03:33 +02:00
|
|
|
- "{{.DOCKER}} run --rm -v ${PWD}/www:/docs mkdocs build"
|
2021-10-10 16:23:33 +02:00
|
|
|
|
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:
|
2023-06-14 04:25:18 +02:00
|
|
|
rpm: "rpm --nodeps -ivh"
|
2021-11-22 01:34:42 +02:00
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "386"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: centos:centos7
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.rpm}} goreleaser-*.i386.rpm"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "amd64"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: fedora
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.rpm}} goreleaser-*.x86_64.rpm"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "arm64"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: fedora
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.rpm}} goreleaser-*.aarch64.rpm"
|
2021-11-14 03:23:11 +02:00
|
|
|
|
|
|
|
goreleaser:test:deb:
|
2021-12-02 22:55:11 +02:00
|
|
|
desc: Tests deb packages
|
2021-11-22 01:34:42 +02:00
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
dpkg: "dpkg --ignore-depends=git -i"
|
2021-11-22 01:34:42 +02:00
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "amd64"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: ubuntu
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.dpkg}} goreleaser*_amd64.deb"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "arm64"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: ubuntu
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.dpkg}} goreleaser*_arm64.deb"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "arm/7"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: ubuntu
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.dpkg}} goreleaser*_armhf.deb"
|
2021-11-14 03:23:11 +02:00
|
|
|
|
|
|
|
goreleaser:test:apk:
|
2021-12-02 22:55:11 +02:00
|
|
|
desc: Tests apk packages
|
2021-11-22 01:34:42 +02:00
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
apk: "apk add --allow-untrusted -U"
|
2021-11-22 01:34:42 +02:00
|
|
|
cmds:
|
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "386"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: alpine
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.apk}} goreleaser*_x86.apk"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "amd64"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: alpine
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.apk}} goreleaser*_x86_64.apk"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "arm64"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: alpine
|
2023-06-14 04:25:18 +02:00
|
|
|
Cmd: "{{.apk}} goreleaser*_aarch64.apk"
|
2021-11-22 01:34:42 +02:00
|
|
|
- task: goreleaser:test:pkg
|
|
|
|
vars:
|
2023-06-14 04:25:18 +02:00
|
|
|
Platform: "arm/7"
|
2021-11-22 01:34:42 +02:00
|
|
|
Image: alpine
|
2023-06-14 04:25:18 +02:00
|
|
|
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:
|
2023-01-31 04:07:12 +02:00
|
|
|
- ./goreleaser release --clean --timeout 60m {{.SNAPSHOT}}
|