1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-27 01:33:39 +02:00
goreleaser/Taskfile.yml

171 lines
6.0 KiB
YAML
Raw Normal View History

# https://taskfile.dev
version: '3'
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org,direct
vars:
DOCKER: '{{default "docker" .DOCKER}}'
tasks:
dev:
desc: Setup git hooks
cmds:
- cp -f scripts/pre-commit.sh .git/hooks/pre-commit
setup:
desc: Install dependencies
cmds:
- go mod tidy
build:
desc: Build the binary
sources:
- ./**/*.go
generates:
- ./goreleaser
cmds:
- go build
test:
desc: Run tests
env:
LC_ALL: C
vars:
TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}'
SOURCE_FILES: '{{default "./..." .SOURCE_FILES}}'
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:
desc: Open the cover tool
cmds:
- go tool cover -html=coverage.txt
fmt:
desc: gofumpt all code
cmds:
- gofumpt -w -l -s .
2021-11-07 04:22:51 +02:00
lint:
desc: Lint the code with golangci-lint
cmds:
- golangci-lint run ./...
2021-11-07 04:22:51 +02:00
ci:
desc: Run all CI steps
cmds:
- task: setup
- task: build
- task: test
default:
desc: Runs the default tasks
cmds:
- task: ci
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
docs:generate:
desc: Generate docs
cmds:
- cp -rf CONTRIBUTING.md www/docs/contributing.md
- cp -rf USERS.md www/docs/users.md
sources:
- CONTRIBUTING.md
- USERS.md
generates:
- www/docs/contributing.md
- www/docs/users.md
docs:imgs:
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
- wget -O www/docs/static/avatar.png https://github.com/goreleaser.png
- convert www/docs/static/avatar.png -define icon:auto-resize=64,48,32,16 www/docs/static/favicon.ico
- convert www/docs/static/avatar.png -resize x120 www/docs/static/apple-touch-icon.png
docs:serve:
desc: Start documentation server
cmds:
- 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'
docs:build:
desc: Build docs
cmds:
- task: docs:generate
- '{{.DOCKER}} run --rm -v ${PWD}/www:/docs docker.io/squidfunk/mkdocs-material build'
docs:vercel:build:
desc: Build documentation for deploying to Vercel
cmds:
- scripts/vercel/install.sh
- scripts/vercel/build.sh
release:
desc: Create a new tag
vars:
NEXT:
sh: svu n
cmds:
- git tag {{.NEXT}}
- echo {{.NEXT}}
- git push origin --tags
goreleaser:test:rpm:
desc: Tests rpm packages
cmds:
2021-11-14 17:27:43 +02:00
# no fedora nor centos with armv6 - docker run --platform linux/arm/6 --rm -v "$PWD/dist":/tmp/ centos:centos7 sh -c 'rpm --nodeps -ivh /tmp/goreleaser-*.arm6l.rpm && goreleaser --version'
- docker run --platform linux/386 --rm -v $PWD/dist:/tmp/ centos:centos7 sh -c 'rpm --nodeps -ivh /tmp/goreleaser-*.i386.rpm && goreleaser --version'
- docker run --platform linux/amd64 --rm -v "$PWD/dist":/tmp/ fedora sh -c 'rpm --nodeps -ivh /tmp/goreleaser-*.x86_64.rpm && goreleaser --version'
- docker run --platform linux/arm64 --rm -v "$PWD/dist":/tmp/ fedora sh -c 'rpm --nodeps -ivh /tmp/goreleaser-*.aarch64.rpm && goreleaser --version'
- docker run --platform linux/arm/6 --rm -v "$PWD/dist":/tmp/ fedora sh -c 'rpm --nodeps -ivh /tmp/goreleaser-*.armv6hl.rpm && goreleaser --version'
- docker run --platform linux/arm/7 --rm -v "$PWD/dist":/tmp/ fedora sh -c 'rpm --nodeps -ivh /tmp/goreleaser-*.armv7hl.rpm && goreleaser --version'
goreleaser:test:deb:
desc: Tests rpm packages
cmds:
2021-11-14 17:27:43 +02:00
- docker run --platform linux/amd64 --rm -v "$PWD/dist":/tmp/ ubuntu bash -c 'dpkg --ignore-depends=git -i /tmp/goreleaser*_amd64.deb && goreleaser --version'
- docker run --platform linux/arm64 --rm -v "$PWD/dist":/tmp/ ubuntu bash -c 'dpkg --ignore-depends=git -i /tmp/goreleaser*_arm64.deb && goreleaser --version'
- docker run --platform linux/arm/6 --rm -v "$PWD/dist":/tmp/ debian bash -c 'dpkg --ignore-depends=git -i /tmp/goreleaser*_armel.deb && goreleaser --version'
- docker run --platform linux/arm/7 --rm -v "$PWD/dist":/tmp/ ubuntu bash -c 'dpkg --ignore-depends=git -i /tmp/goreleaser*_armhf.deb && goreleaser --version'
goreleaser:test:apk:
desc: Tests rpm packages
cmds:
2021-11-14 17:27:43 +02:00
- docker run --platform linux/386 --rm -v "$PWD/dist":/tmp/ alpine ash -c 'apk add --allow-untrusted -U /tmp/goreleaser*_x86.apk && goreleaser --version'
- docker run --platform linux/amd64 --rm -v "$PWD/dist":/tmp/ alpine ash -c 'apk add --allow-untrusted -U /tmp/goreleaser*_x86_64.apk && goreleaser --version'
- docker run --platform linux/arm64 --rm -v "$PWD/dist":/tmp/ alpine ash -c 'apk add --allow-untrusted -U /tmp/goreleaser*_aarch64.apk && goreleaser --version'
- docker run --platform linux/arm/6 --rm -v "$PWD/dist":/tmp/ alpine ash -c 'apk add --allow-untrusted -U /tmp/goreleaser*_armhf.apk && goreleaser --version'
- docker run --platform linux/arm/7 --rm -v "$PWD/dist":/tmp/ alpine ash -c 'apk add --allow-untrusted -U /tmp/goreleaser*_armv7.apk && goreleaser --version'
goreleaser:test:
desc: Runs a local release and test some stuff
cmds:
- task: goreleaser:test:apk
- task: goreleaser:test:deb
- task: goreleaser:test:rpm
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}}