Skip to content

Commit

Permalink
Moved to GH actions; Added lint; Added issue/PR templates.
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <[email protected]>

# Conflicts:
#	Makefile
  • Loading branch information
bwplotka committed Jun 4, 2020
1 parent e482ad4 commit 533f0ef
Show file tree
Hide file tree
Showing 23 changed files with 401 additions and 48 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.1. 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.1
$(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.1"
@cd .bingo && $(GO) build -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.2.1 "github.com/bwplotka/bingo"

FAILLINT := $(GOBIN)/faillint-v1.5.0
$(FAILLINT): .bingo/faillint.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)/faillint-v1.5.0"
@cd .bingo && $(GO) build -modfile=faillint.mod -o=$(GOBIN)/faillint-v1.5.0 "github.com/fatih/faillint"

GOIMPORTS := $(GOBIN)/goimports-v0.0.0-20200529172331-a64b76657301
$(GOIMPORTS): .bingo/goimports.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)/goimports-v0.0.0-20200529172331-a64b76657301"
@cd .bingo && $(GO) build -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.0.0-20200529172331-a64b76657301 "golang.org/x/tools/cmd/goimports"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.27.0
$(GOLANGCI_LINT): .bingo/golangci-lint.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)/golangci-lint-v1.27.0"
@cd .bingo && $(GO) build -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.27.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"

MISSPELL := $(GOBIN)/misspell-v0.3.4
$(MISSPELL): .bingo/misspell.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)/misspell-v0.3.4"
@cd .bingo && $(GO) build -modfile=misspell.mod -o=$(GOBIN)/misspell-v0.3.4 "github.com/client9/misspell/cmd/misspell"

PROTOC_GEN_GOGOFAST := $(GOBIN)/protoc-gen-gogofast-v1.3.1
$(PROTOC_GEN_GOGOFAST): .bingo/protoc-gen-gogofast.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)/protoc-gen-gogofast-v1.3.1"
@cd .bingo && $(GO) build -modfile=protoc-gen-gogofast.mod -o=$(GOBIN)/protoc-gen-gogofast-v1.3.1 "github.com/gogo/protobuf/protoc-gen-gogofast"

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

go 1.14

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

go 1.14

require github.com/fatih/faillint v1.5.0
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.
5 changes: 5 additions & 0 deletions .bingo/goimports.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require golang.org/x/tools v0.0.0-20200529172331-a64b76657301 // cmd/goimports
8 changes: 8 additions & 0 deletions .bingo/golangci-lint.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.14

require (
github.com/golangci/golangci-lint v1.27.0 // cmd/golangci-lint
github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd // indirect
)
5 changes: 5 additions & 0 deletions .bingo/misspell.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require github.com/client9/misspell v0.3.4 // cmd/misspell
5 changes: 5 additions & 0 deletions .bingo/protoc-gen-gogofast.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require github.com/gogo/protobuf v1.3.1 // protoc-gen-gogofast
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.1. 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.1"

FAILLINT="${gobin}/faillint-v1.5.0"

GOIMPORTS="${gobin}/goimports-v0.0.0-20200529172331-a64b76657301"

GOLANGCI_LINT="${gobin}/golangci-lint-v1.27.0"

MISSPELL="${gobin}/misspell-v0.3.4"

PROTOC_GEN_GOGOFAST="${gobin}/protoc-gen-gogofast-v1.3.1"

15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
Template relevant to bug reports only!
Keep issue title verbose enough.
-->

**Go version used**:

**What happened**:

**What you expected to happen**:

**How to reproduce it (as minimally and precisely as possible)**:

-->
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
Keep PR title verbose enough.
-->

<!--
Don't forget about CHANGELOG!
Changelog entry format:
- [#<PR-id>](<PR-URL>) ...
<PR-id> Id of your pull request.
<PR-URL> URL of your PR such as https://github.com/grpc-ecosystem/go-grpc-middleware/pull/<PR-id>
-->

* [ ] I added CHANGELOG entry for this change.
* [ ] Change is not relevant to the end user.

## Changes

<!-- Enumerate changes you made -->

## Verification

<!-- How you tested it? How do you know it works? -->
50 changes: 50 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable.
# We want stale bot to notify us that something is stale so we can revisit it.
# If one issue is marked as 'reminder' by the reminder bot, we don't mark it as 'stale' again.
exemptLabels:
# This label is hardcoded on remind bot (https://probot.github.io/apps/reminders/) and is used by remind bot when
# issue is being reminded.
- reminder

# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale

pull:
daysUntilClose: 14
daysUntilStale: 30
markComment: >
Hello 👋 Looks like there was no activity on this amazing PR for the last month.
**Do you mind updating us on the status?** Is there anything we can help with? If you plan to still work on it, just comment on this PR or push a commit. Thanks! 🤗
If there is no activity for the next 2 weeks, this PR will be closed (we can always reopen a PR if you get back to this!).
#unmarkComment: No need for unmark comment.
closeComment: >
Closing for now as promised, let us know if you need this to be reopened! 🤗
issues:
daysUntilClose: 14
daysUntilStale: 60
markComment: >
Hello 👋 Looks like there was no activity on this issue for the last 2 months.
**Do you mind updating us on the status?** Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there is no activity for the next 2 weeks, this issue will be closed (we can always reopen an issue if requested!).
#unmarkComment: No need for unmark comment.
closeComment: >
Closing for now as promised, let us know if you need this to be reopened! 🤗
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
57 changes: 57 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: go

on:
push:
branches:
- master
tags:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
name: Linters (Static Analysis) for Go
steps:
- name: Checkout code into the Go module directory.
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Linting & vetting.
run: make lint

tests:
runs-on: ${{ matrix.platform }}
name: Unit tests on Go ${{ matrix.go }}
strategy:
fail-fast: false
matrix:
go: [ '1.12.x', '1.13.x', '1.14.x' ]
platform: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code into the Go module directory.
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Run unit tests.
run: make test

- name: Calculating code coverage.
run: bash <(curl -s https://codecov.io/bash)
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 533f0ef

Please sign in to comment.