Skip to content

Commit

Permalink
chore: build, makefile, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Feb 16, 2018
1 parent 186cf62 commit b2faa8b
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
license: MIT
vendor: GoReleaser
formats:
- deb
- rpm
# TODO: should be able to do that "suggested packages" thing
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
63 changes: 61 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
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,github.com/alecthomas/template
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

0 comments on commit b2faa8b

Please sign in to comment.