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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-04-01 19:07:38 +02:00
|
|
|
docker:setup:
|
|
|
|
desc: Setup Docker for multi-arch image builds
|
|
|
|
cmds:
|
|
|
|
- docker run --privileged --rm tonistiigi/binfmt --install all
|
|
|
|
|
2021-10-06 01:05:22 +02:00
|
|
|
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:
|
2024-11-16 15:30:39 +02:00
|
|
|
- go test {{.TEST_OPTIONS}} -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -run {{.TEST_PATTERN}} -timeout=15m
|
2021-10-06 01:05:22 +02:00
|
|
|
|
|
|
|
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:
|
2023-11-30 04:11:46 +02:00
|
|
|
- golangci-lint run --config ./.golangci.yaml ./...
|
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
|
|
|
|
2024-02-13 04:22:55 +02:00
|
|
|
nix:flake:build:
|
|
|
|
desc: build goreleaser using the nix flake
|
|
|
|
cmds:
|
|
|
|
- task: nix:flake:update-vendor
|
|
|
|
- nix build .
|
|
|
|
|
2024-04-01 20:46:13 +02:00
|
|
|
nix:flake:update:
|
|
|
|
desc: update flake.lock
|
|
|
|
cmds:
|
|
|
|
- nix flake update
|
|
|
|
generates:
|
|
|
|
- flake.lock
|
|
|
|
|
2024-02-13 04:22:55 +02:00
|
|
|
nix:flake:update-vendor:
|
|
|
|
desc: update default flake package vendor hash
|
|
|
|
cmds:
|
2024-11-07 18:33:54 +02:00
|
|
|
- bash ./scripts/nix-update-flake.sh
|
2024-02-13 04:22:55 +02:00
|
|
|
generates:
|
|
|
|
- flake.nix
|
|
|
|
sources:
|
|
|
|
- flake.lock
|
|
|
|
- go.mod
|
|
|
|
- go.sum
|
|
|
|
|
2023-12-26 13:37:44 +02:00
|
|
|
nix:licenses:generate:
|
|
|
|
desc: Generate nix/licenses.go
|
|
|
|
cmds:
|
|
|
|
- ./scripts/gen-nix-licenses.sh
|
|
|
|
generates:
|
|
|
|
- ./internal/pipe/nix/licenses.go
|
|
|
|
|
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
|
|
|
|
|
2023-12-31 19:43:35 +02:00
|
|
|
schema:validate:
|
|
|
|
desc: Validate JSONSchema
|
|
|
|
cmds:
|
|
|
|
- jv ./www/docs/static/schema.json
|
|
|
|
sources:
|
|
|
|
- ./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
|
2024-07-10 05:03:07 +02:00
|
|
|
- "mkdocs serve -f www/mkdocs.yml -a 0.0.0.0:8000"
|
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-12-29 01:49:23 +02:00
|
|
|
- "mkdocs build -f www/mkdocs.yml"
|
|
|
|
|
|
|
|
docs:test:
|
|
|
|
desc: Test docs with htmltest
|
|
|
|
cmds:
|
|
|
|
- task: docs:build
|
|
|
|
- "htmltest www/site -c www/htmltest.yml"
|
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:
|
2024-11-04 15:26:28 +02:00
|
|
|
- git tag -d nightly
|
2021-10-06 04:23:19 +02:00
|
|
|
- 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}}
|
2023-08-09 15:12:42 +02:00
|
|
|
|
|
|
|
nightly:
|
|
|
|
cmds:
|
|
|
|
- gh run list --workflow=nightly-oss.yml
|
|
|
|
- gh workflow run nightly-oss.yml
|
|
|
|
- sleep 30
|
|
|
|
- gh run watch
|