1
1
mirror of https://github.com/goreleaser/nfpm synced 2024-11-19 07:34:48 +01:00

chore: build, makefile, etc

This commit is contained in:
Carlos Alexandro Becker 2018-02-16 20:38:45 -02:00
parent 186cf62043
commit b2faa8b743
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 134 additions and 3 deletions

51
.goreleaser.yml Normal file

@ -0,0 +1,51 @@
builds:
- main: ./cmd/nfpm/...
hooks:
pre: packr
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
dockers:
- image: goreleaser/nfpm
tag_templates:
- '{{ .Tag }}'
- 'v{{ .Major }}.{{ .Minor }}'
- 'latest'
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
brew:
github:
owner: goreleaser
name: homebrew-tap
folder: Formula
homepage: https://github.com/goreleaser/nfpm
description: NFPM is not FPM
test: |
system "#{bin}/nfpm -v"
scoop:
bucket:
owner: goreleaser
name: scoop-bucket
homepage: https://github.com/goreleaser/nfpm
description: NFPM is not FPM
license: MIT
fpm: # TODO: change to nfpm when released
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
homepage: https://github.com/goreleaser/nfpm
description: NFPM is not FPM
maintainer: Carlos Alexandro Becker <root@carlosbecker.com>
license: MIT
vendor: GoReleaser
formats:
- deb
- rpm
# TODO: should be able to do that "suggested packages" thing

21
.travis.yml Normal file

@ -0,0 +1,21 @@
dist: trusty
sudo: required
language: go
go: 1.9
services:
- docker
install:
- make setup
script:
- make ci
after_success:
- bash <(curl -s https://codecov.io/bash)
- test -n "$TRAVIS_TAG" && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
notifications:
email: false
deploy:
- provider: script
skip_cleanup: true
script: curl -sL http://git.io/goreleaser | bash
on:
tags: true

@ -1,5 +1,64 @@
check:
bandep --ban github.com/tj/assert,github.com/alecthomas/template
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
# Install all the build and lint dependencies
setup:
go get -u github.com/alecthomas/gometalinter
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/pierrre/gotestcover
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/caarlos0/bandep
dep ensure
gometalinter --install
echo "make check" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
.PHONY: setup
check:
bandep --ban github.com/tj/assert
.PHONY: check
# Run all the tests
test:
go test -v ./...
gotestcover $(TEST_OPTIONS) -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: cover
# Run all the tests and opens the coverage report
cover: test
go tool cover -html=coverage.txt
.PHONY: cover
# gofmt and goimports all go files
fmt:
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
.PHONY: fmt
# Run all the linters
lint:
gometalinter --vendor ./...
.PHONY: lint
# Run all the tests and code checks
ci: build test lint
.PHONY: ci
# Build a beta version of goreleaser
build:
go generate ./...
go build
.PHONY: build
# Show to-do items per file.
todo:
@grep \
--exclude-dir=vendor \
--exclude-dir=node_modules \
--exclude=Makefile \
--text \
--color \
-nRo -E ' TODO:.*|SkipNow|nolint:.*' .
.PHONY: todo
.DEFAULT_GOAL := build