Skip to content

Commit

Permalink
Merge pull request #9 from promhippie/various-improvements
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
tboerger committed Mar 14, 2021
2 parents 82f96af + 35cd305 commit c6afb1e
Show file tree
Hide file tree
Showing 20 changed files with 907 additions and 373 deletions.
12 changes: 12 additions & 0 deletions .bingo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Ignore everything
*

# But not these files:
!.gitignore
!*.mod
!README.md
!Variables.mk
!variables.env

*tmp.mod
13 changes: 13 additions & 0 deletions .bingo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Project Development Dependencies.

This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo.

* Run `bingo get` to install all tools having each own module file in this directory.
* Run `bingo get <tool>` to install <tool> that have own module file in this directory.
* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $(<upper case tool name>) variable where <tool> is the .bingo/<tool>.mod.
* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool
* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies.

## Requirements

* Go 1.14+
54 changes: 54 additions & 0 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.2. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin
GO ?= $(shell which go)

# Bellow generated variables ensure that every time a tool under each variable is invoked, the correct version
# will be used; reinstalling only if needed.
# For example for bingo variable:
#
# In your main Makefile (for non array binaries):
#
#include .bingo/Variables.mk # Assuming -dir was set to .bingo .
#
#command: $(BINGO)
# @echo "Running bingo"
# @$(BINGO) <flags/args..>
#
BINGO := $(GOBIN)/bingo-v0.2.3
$(BINGO): .bingo/bingo.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/bingo-v0.2.3"
@cd .bingo && $(GO) build -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.2.3 "github.com/bwplotka/bingo"

CALENS := $(GOBIN)/calens-v0.2.0
$(CALENS): .bingo/calens.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/calens-v0.2.0"
@cd .bingo && $(GO) build -modfile=calens.mod -o=$(GOBIN)/calens-v0.2.0 "github.com/restic/calens"

GOLINT := $(GOBIN)/golint-v0.0.0-20200302205851-738671d3881b
$(GOLINT): .bingo/golint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/golint-v0.0.0-20200302205851-738671d3881b"
@cd .bingo && $(GO) build -modfile=golint.mod -o=$(GOBIN)/golint-v0.0.0-20200302205851-738671d3881b "golang.org/x/lint/golint"

GOVERAGE := $(GOBIN)/goverage-v0.0.0-20180129164344-eec3514a20b5
$(GOVERAGE): .bingo/goverage.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/goverage-v0.0.0-20180129164344-eec3514a20b5"
@cd .bingo && $(GO) build -modfile=goverage.mod -o=$(GOBIN)/goverage-v0.0.0-20180129164344-eec3514a20b5 "github.com/haya14busa/goverage"

REFLEX := $(GOBIN)/reflex-v0.3.0
$(REFLEX): .bingo/reflex.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/reflex-v0.3.0"
@cd .bingo && $(GO) build -modfile=reflex.mod -o=$(GOBIN)/reflex-v0.3.0 "github.com/cespare/reflex"

STATICCHECK := $(GOBIN)/staticcheck-v0.0.1-2020.1.6
$(STATICCHECK): .bingo/staticcheck.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/staticcheck-v0.0.1-2020.1.6"
@cd .bingo && $(GO) build -modfile=staticcheck.mod -o=$(GOBIN)/staticcheck-v0.0.1-2020.1.6 "honnef.co/go/tools/cmd/staticcheck"

9 changes: 9 additions & 0 deletions .bingo/bingo.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.15

require (
github.com/bwplotka/bingo v0.2.3
golang.org/x/mod v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)
13 changes: 13 additions & 0 deletions .bingo/calens.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.15

require (
github.com/Masterminds/sprig/v3 v3.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/restic/calens v0.2.0
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect
)
1 change: 1 addition & 0 deletions .bingo/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.
8 changes: 8 additions & 0 deletions .bingo/golint.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.15

require (
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // golint
golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect
)
9 changes: 9 additions & 0 deletions .bingo/reflex.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.15

require (
github.com/cespare/reflex v0.3.0
github.com/fsnotify/fsnotify v1.4.9 // indirect
golang.org/x/sys v0.0.0-20201028094953-708e7fb298ac // indirect
)
8 changes: 8 additions & 0 deletions .bingo/staticcheck.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.15

require (
golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect
honnef.co/go/tools v0.0.1-2020.1.6 // cmd/staticcheck
)
22 changes: 22 additions & 0 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.2. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk.
local gobin=$(go env GOBIN)

if [ -z "$gobin" ]; then
gobin="$(go env GOPATH)/bin"
fi


BINGO="${gobin}/bingo-v0.2.3"

CALENS="${gobin}/calens-v0.2.0"

GOLINT="${gobin}/golint-v0.0.0-20200302205851-738671d3881b"

GOVERAGE="${gobin}/goverage-v0.0.0-20180129164344-eec3514a20b5"

REFLEX="${gobin}/reflex-v0.3.0"

STATICCHECK="${gobin}/staticcheck-v0.0.1-2020.1.6"

8 changes: 5 additions & 3 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
exclude_paths:
- .github/*.md
- CODE_OF_CONDUCT.md
- .github/**
- .bingo/**
- changelog/**
- docs/**

- CHANGELOG.md
- changelog/**/*.md

...
52 changes: 31 additions & 21 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def testing(ctx):
'steps': [
{
'name': 'generate',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make generate',
Expand All @@ -47,7 +47,7 @@ def testing(ctx):
},
{
'name': 'vet',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make vet',
Expand All @@ -61,7 +61,7 @@ def testing(ctx):
},
{
'name': 'staticcheck',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make staticcheck',
Expand All @@ -75,7 +75,7 @@ def testing(ctx):
},
{
'name': 'lint',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make lint',
Expand All @@ -89,7 +89,7 @@ def testing(ctx):
},
{
'name': 'build',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make build',
Expand All @@ -103,7 +103,7 @@ def testing(ctx):
},
{
'name': 'test',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make test',
Expand Down Expand Up @@ -150,19 +150,29 @@ def docker(ctx, arch):

if arch == 'amd64':
agent = 'amd64'
environment = {}
environment = {
'GOARCH': 'amd64',
}

if arch == 'arm32v6':
agent = 'arm'
environment = {}
agent = 'amd64'
environment = {
'GOARCH': 'arm',
'GOARM': '6',
}

if arch == 'arm32v7':
agent = 'arm'
environment = {}
agent = 'amd64'
environment = {
'GOARCH': 'arm',
'GOARM': '7',
}

if arch == 'arm64v8':
agent = 'arm64'
environment = {}
agent = 'amd64'
environment = {
'GOARCH': 'arm64',
}

if ctx.build.event == 'pull_request':
docker = {
Expand Down Expand Up @@ -196,7 +206,7 @@ def docker(ctx, arch):
'steps': [
{
'name': 'version',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'environment': environment,
'commands': [
Expand All @@ -211,7 +221,7 @@ def docker(ctx, arch):
},
{
'name': 'generate',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'environment': environment,
'commands': [
Expand All @@ -226,7 +236,7 @@ def docker(ctx, arch):
},
{
'name': 'build',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'environment': environment,
'commands': [
Expand Down Expand Up @@ -276,7 +286,7 @@ def binary(ctx, name):
'steps': [
{
'name': 'generate',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make generate',
Expand All @@ -290,7 +300,7 @@ def binary(ctx, name):
},
{
'name': 'build',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make release-%s' % (name),
Expand All @@ -304,7 +314,7 @@ def binary(ctx, name):
},
{
'name': 'finish',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make release-finish',
Expand Down Expand Up @@ -526,15 +536,15 @@ def changelog(ctx):
},
{
'name': 'generate',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'make changelog',
],
},
{
'name': 'changes',
'image': 'webhippie/golang:1.14',
'image': 'webhippie/golang:1.15',
'pull': 'always',
'commands': [
'git diff CHANGELOG.md',
Expand Down
21 changes: 21 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": [
"config:base",
":automergeMinor",
":automergeDigest",
"docker:enableMajor",
"docker:pinDigests"
],
"enabledManagers": [
"gomod",
"dockerfile"
],
"gomod": {
"postUpdateOptions": [
"gomodTidy"
]
},
"labels": [
"renovate"
]
}
Loading

0 comments on commit c6afb1e

Please sign in to comment.