Skip to content

Commit

Permalink
(#1) Project skeleton
Browse files Browse the repository at this point in the history
WIP

Pending:
- releasing
- codecov
- finish .travis.yml
  • Loading branch information
George Aristy authored and llorllale committed Feb 15, 2019
1 parent 5869b49 commit 3d704cd
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gometalinter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Aggregate": true,
"Cyclo": 10,
"EnableAll": true,
"EnableGC": true,
"LineLength": 100,
"Test": true,
"Vendor": true,
"WarnUnmatchedDirective": true
}
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
#before:
# hooks:
# # you may remove this if you don't use vgo
# - go mod download
# # you may remove this if you don't need go generate
# - go generate ./...

project_name: go-gitlint
builds:
env:
- CGO_ENABLED=0
main: ./cmd/go-gitlint/main.go
binary: go-gitlint
goos:
- linux
- windows
- darwin
goarch:
- 386
- amd64
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
release:
name_template: "{{.Env.RELEASE_VER}}"
prerelease: auto
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
6 changes: 6 additions & 0 deletions .pdd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--source=.
--verbose
--rule min-words:20
--rule min-estimate:0
--rule max-estimate:0

22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
dist: trusty

language: go
go:
- "1.11.x"
- tip

jobs:
include:
- if: type = pull_request
script: make all &&
bash <(curl -s https://codecov.io/bash)
- if: type = push AND branch = master
script: git fetch --tags &&
make all &&
bash <(curl -s https://codecov.io/bash) &&
docker run --rm --privileged \
-v $PWD:/go/src/github.com/user/repo \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/user/repo \
-e GITHUB_TOKEN \
goreleaser/goreleaser:v0.101-cgo release
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# Copyright 2019 George Aristy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Supported Targets:
#
# all : make all recipes
# test: runs tests
# lint: runs linters
#

all: compile test lint

compile:
@go build main.go

test:
@go test -count=1 -race -cover -coverprofile=coverage.txt -covermode=atomic ./...

lint:
@curl -L https://git.io/vp6lP | sh
@gometalinter ./...
5 changes: 5 additions & 0 deletions cmd/go-gitlint/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package main

func main() {
panic("TODO - not yet implemented")
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module github.com/llorllale/go-gitlint
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
github.com/alecthomas/gometalinter v2.0.12+incompatible h1:RBUbc8pKtqRoVCymENDl7cpWS9Ht5XNnwwk0cKjpteI=
github.com/alecthomas/gometalinter v2.0.12+incompatible/go.mod h1:qfIpQGGz3d+NmgyPBqv+LSh50emm1pt72EtcX2vKYQk=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf h1:7+FW5aGwISbqUtkfmIpZJGRgNFg2ioYPvFaUxdqpDsg=
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE=
github.com/nicksnyder/go-i18n v1.10.0 h1:5AzlPKvXBH4qBzmZ09Ua9Gipyruv6uApMcrNZdo96+Q=
github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c h1:vTxShRUnK60yd8DZU+f95p1zSLj814+5CuEh7NjF2/Y=
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c/go.mod h1:3HH7i1SgMqlzxCcBmUHW657sD4Kvv9sC3HpL3YukzwA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
21 changes: 21 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2019 George Aristy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

func main() {
panic("TODO - not yet implemented")
}
51 changes: 51 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Copyright 2019 George Aristy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

VERSION=0.1.0-snapshot

is_snapshot()
{
[[ $VERSION =~ ^.*-snapshot$ ]] && echo 1 || echo 0
}

release_candidate_version()
{
DESCRIBE=$(git describe)

if [ -z "$DESCRIBE" ]; then
RC_VERSION=$(git rev-list --count HEAD)
else
RC_VERSION=$(echo $DESCRIBE | cut -d - -f 2)
fi

echo $(echo $VERSION | sed "s/snapshot/rc$RC_VERSION/")
}

if [ $(is_snapshot) == 1 ]; then
git fetch --tags
RELEASE_VER=$(release_candidate_version)
elif
RELEASE_VER=$VERSION
fi

export $RELEASE_VER

docker run --rm --privileged \
-v $PWD:/go/src/github.com/user/repo \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/user/repo \
-e GITHUB_TOKEN \
goreleaser/goreleaser:v0.101-cgo release

0 comments on commit 3d704cd

Please sign in to comment.