Skip to content

Commit

Permalink
Merge pull request #1 from rohenaz/dev/mrz
Browse files Browse the repository at this point in the history
Repo Templates, Polish, Fixing, Etc
  • Loading branch information
rohenaz authored Sep 30, 2020
2 parents 1db326e + 6daf27c commit 42442c5
Show file tree
Hide file tree
Showing 25 changed files with 595 additions and 105 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: rohenaz
custom: https://gobitcoinsv.com/?tab=tips&af=go-bitcoin
Binary file added .github/IMAGES/github-share-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve this project
labels: bug-p3
assignees: mrz1836

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
labels: idea
assignees: mrz1836

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Question
about: 'General template for a question '
labels: question
assignees: mrz1836

---

**What's your question?**
A clear and concise question using references to specific regions of code if applicable.

**Additional context**
Add any other context or information.
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Fixes #

## Proposed Changes

-
-
-
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@

# Dependency directories (remove the comment below to include it)
# vendor/

# JetBeans
.idea
27 changes: 27 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Make sure to check the documentation at http://goreleaser.com
# ---------------------------
# GENERAL
# ---------------------------
before:
hooks:
- make all
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^.github:'
- '^test:'

# ---------------------------
# BUILDER
# ---------------------------
build:
skip: true
# ---------------------------
# Github Release
# ---------------------------
release:
prerelease: true
name_template: "Release v{{.Version}}"
71 changes: 71 additions & 0 deletions .make/Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## Default repository domain name
ifndef GIT_DOMAIN
override GIT_DOMAIN=github.com
endif

## Set if defined (alias variable for ease of use)
ifdef branch
override REPO_BRANCH=$(branch)
export REPO_BRANCH
endif

## Do we have git available?
HAS_GIT := $(shell command -v git 2> /dev/null)

ifdef HAS_GIT
## Do we have a repo?
HAS_REPO := $(shell git rev-parse --is-inside-work-tree 2> /dev/null)
ifdef HAS_REPO
## Automatically detect the repo owner and repo name (for local use with Git)
REPO_NAME=$(shell basename "$(shell git rev-parse --show-toplevel 2> /dev/null)")
REPO_OWNER=$(shell git config --get remote.origin.url | sed 's/git@$(GIT_DOMAIN)://g' | sed 's/\/$(REPO_NAME).git//g')
VERSION_SHORT=$(shell git describe --tags --always --abbrev=0)
export REPO_NAME, REPO_OWNER, VERSION_SHORT
endif
endif

## Set the distribution folder
ifndef DISTRIBUTIONS_DIR
override DISTRIBUTIONS_DIR=./dist
endif
export DISTRIBUTIONS_DIR

help: ## Show this help message
@egrep -h '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'

release:: ## Full production release (creates release in Github)
@test $(github_token)
@export GITHUB_TOKEN=$(github_token) && goreleaser --rm-dist

release-test: ## Full production test release (everything except deploy)
@goreleaser --skip-publish --rm-dist

release-snap: ## Test the full release (build binaries)
@goreleaser --snapshot --skip-publish --rm-dist

replace-version: ## Replaces the version in HTML/JS (pre-deploy)
@test $(version)
@test "$(path)"
@find $(path) -name "*.html" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \;
@find $(path) -name "*.js" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \;

tag: ## Generate a new tag and push (tag version=0.0.0)
@test $(version)
@git tag -a v$(version) -m "Pending full release..."
@git push origin v$(version)
@git fetch --tags -f

tag-remove: ## Remove a tag if found (tag-remove version=0.0.0)
@test $(version)
@git tag -d v$(version)
@git push --delete origin v$(version)
@git fetch --tags

tag-update: ## Update an existing tag to current commit (tag-update version=0.0.0)
@test $(version)
@git push --force origin HEAD:refs/tags/v$(version)
@git fetch --tags -f

update-releaser: ## Update the goreleaser application
@brew update
@brew upgrade goreleaser
80 changes: 80 additions & 0 deletions .make/Makefile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## Default to the repo name if empty
ifndef BINARY_NAME
override BINARY_NAME=app
endif

## Define the binary name
ifdef CUSTOM_BINARY_NAME
override BINARY_NAME=$(CUSTOM_BINARY_NAME)
endif

## Set the binary release names
DARWIN=$(BINARY_NAME)-darwin
LINUX=$(BINARY_NAME)-linux
WINDOWS=$(BINARY_NAME)-windows.exe

.PHONY: test lint install

bench: ## Run all benchmarks in the Go application
@go test -bench=. -benchmem

build-go: ## Build the Go application (locally)
@go build -o bin/$(BINARY_NAME)

clean-mods: ## Remove all the Go mod cache
@go clean -modcache

coverage: ## Shows the test coverage
@go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out

godocs: ## Sync the latest tag with GoDocs
@test $(GIT_DOMAIN)
@test $(REPO_OWNER)
@test $(REPO_NAME)
@test $(VERSION_SHORT)
@curl https://proxy.golang.org/$(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)/@v/$(VERSION_SHORT).info

install: ## Install the application
@go build -o $$GOPATH/bin/$(BINARY_NAME)

install-go: ## Install the application (Using Native Go)
@go install $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)

lint: ## Run the Go lint application
@if [ "$(shell command -v golint)" = "" ]; then go get -u golang.org/x/lint/golint; fi
@golint

test: ## Runs vet, lint and ALL tests
@$(MAKE) vet
@$(MAKE) lint
@go test ./... -v

test-short: ## Runs vet, lint and tests (excludes integration tests)
@$(MAKE) vet
@$(MAKE) lint
@go test ./... -v -test.short

test-travis: ## Runs all tests via Travis (also exports coverage)
@$(MAKE) vet
@$(MAKE) lint
@go test ./... -race -coverprofile=coverage.txt -covermode=atomic

test-travis-short: ## Runs unit tests via Travis (also exports coverage)
@$(MAKE) vet
@$(MAKE) lint
@go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic

uninstall: ## Uninstall the application (and remove files)
@test $(BINARY_NAME)
@test $(GIT_DOMAIN)
@test $(REPO_OWNER)
@test $(REPO_NAME)
@go clean -i $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)
@rm -rf $$GOPATH/src/$(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)
@rm -rf $$GOPATH/bin/$(BINARY_NAME)

update: ## Update all project dependencies
@go get -u ./... && go mod tidy

vet: ## Run the Go vet application
@go vet -v ./...
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Fast runner (trick from @y0ssar1an) (out-dated)
sudo: false

# Language of deployment
language: go

# Version
go:
- 1.15.x

# Environment variables
env:
- GO111MODULE=on

# Only clone the most recent commit
git:
depth: 1

# Notifications off
notifications:
email: false

# Run all scripts
script:
- make test-travis

# After build success
after_success:
- bash <(curl -s https://codecov.io/bash)
52 changes: 52 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Code of Merit

1. The project creators, lead developers, core team, constitute
the managing members of the project and have final say in every decision
of the project, technical or otherwise, including overruling previous decisions.
There are no limitations to this decisional power.

2. Contributions are an expected result of your membership on the project.
Don't expect others to do your work or help you with your work forever.

3. All members have the same opportunities to seek any challenge they want
within the project.

4. Authority or position in the project will be proportional
to the accrued contribution. Seniority must be earned.

5. Software is evolutive: the better implementations must supersede lesser
implementations. Technical advantage is the primary evaluation metric.

6. This is a space for technical prowess; topics outside of the project
will not be tolerated.

7. Non technical conflicts will be discussed in a separate space. Disruption
of the project will not be allowed.

8. Individual characteristics, including but not limited to,
body, sex, sexual preference, race, language, religion, nationality,
or political preferences are irrelevant in the scope of the project and
will not be taken into account concerning your value or that of your contribution
to the project.

9. Discuss or debate the idea, not the person.

10. There is no room for ambiguity: Ambiguity will be met with questioning;
further ambiguity will be met with silence. It is the responsibility
of the originator to provide requested context.

11. If something is illegal outside the scope of the project, it is illegal
in the scope of the project. This Code of Merit does not take precedence over
governing law.

12. This Code of Merit governs the technical procedures of the project not the
activities outside of it.

13. Participation on the project equates to agreement of this Code of Merit.

14. No objectives beyond the stated objectives of this project are relevant
to the project. Any intent to deviate the project from its original purpose
of existence will constitute grounds for remedial action which may include
expulsion from the project.

This document is the Code of Merit (<del>`http://code-of-merit.org`</del>), version 1.0.
37 changes: 37 additions & 0 deletions CODE_STANDARDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Code Standards

This project uses the following code standards and specifications from:
- [effective go](https://golang.org/doc/effective_go.html)
- [go tests](https://golang.org/pkg/testing/)
- [go examples](https://golang.org/pkg/testing/#hdr-Examples)
- [go benchmarks](https://golang.org/pkg/testing/#hdr-Benchmarks)
- [gofmt](https://golang.org/cmd/gofmt/)
- [golint](https://github.com/golang/lint)
- [godoc](https://godoc.org/golang.org/x/tools/cmd/godoc)
- [vet](https://golang.org/cmd/vet/)
- [report card](https://goreportcard.com/)

### *effective go* standards
View the [effective go](https://golang.org/doc/effective_go.html) standards documentation.

### *golint* specifications
The package [golint](https://github.com/golang/lint) differs from [gofmt](https://golang.org/cmd/gofmt/). The package [gofmt](https://golang.org/cmd/gofmt/) formats Go source code, whereas [golint](https://github.com/golang/lint) prints out style mistakes. The package [golint](https://github.com/golang/lint) differs from [vet](https://golang.org/cmd/vet/). The package [vet](https://golang.org/cmd/vet/) is concerned with correctness, whereas [golint](https://github.com/golang/lint) is concerned with coding style. The package [golint](https://github.com/golang/lint) is in use at Google, and it seeks to match the accepted style of the open source [Go project](https://golang.org/).

How to install [golint](https://github.com/golang/lint):
```shell script
go get -u golang.org/x/lint/golint
cd ../go-bitcoin
golint
```

### *go vet* specifications
[Vet](https://golang.org/cmd/vet/) examines Go source code and reports suspicious constructs. [Vet](https://golang.org/cmd/vet/) uses heuristics that do not guarantee all reports are genuine problems, but it can find errors not caught by the compilers.

How to run [vet](https://golang.org/cmd/vet/):
```shell script
cd ../go-bitcoin
go vet -v
```

### *godoc* specifications
All code is written with documentation in mind. Follow the best practices with naming, examples and function descriptions.
Loading

0 comments on commit 42442c5

Please sign in to comment.