-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ccremer/polishing
Update project plumbing
- Loading branch information
Showing
19 changed files
with
242 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Summary | ||
|
||
|
||
|
||
## Checklist | ||
|
||
- [ ] Keep pull requests small so they can be easily reviewed. | ||
- [ ] Categorize the PR by setting a good title and adding one of the labels: | ||
`fix`, `enhancement`, `documentation`, `change`, `breaking`, `dependency` | ||
as they show up in the changelog | ||
- [ ] Update documentation. | ||
- [ ] Update tests. | ||
- [ ] Link this PR to related issues. | ||
|
||
<!-- | ||
Remove items that do not apply. For completed items, change [ ] to [x]. | ||
These things are not required to open a PR and can be done afterwards, | ||
while the PR is open. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"pr_template": "- ${{TITLE}} (#${{NUMBER}})", | ||
"categories": [ | ||
{ | ||
"title": "## 🚀 Features", | ||
"labels": ["enhancement", "feature"] | ||
}, | ||
{ | ||
"title": "## 🛠️ Minor Changes", | ||
"labels": ["change"] | ||
}, | ||
{ | ||
"title": "## 🔎 Breaking Changes", | ||
"labels": ["breaking"] | ||
}, | ||
{ | ||
"title": "## 🐛 Fixes", | ||
"labels": ["bug", "fix"] | ||
}, | ||
{ | ||
"title": "## 📄 Documentation", | ||
"labels": ["documentation"] | ||
}, | ||
{ | ||
"title": "## 🔗 Dependency Updates", | ||
"labels": ["dependency"] | ||
} | ||
], | ||
"template": "${{CATEGORIZED_COUNT}} changes since ${{FROM_TAG}}\n\n${{CHANGELOG}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: {} | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Determine Go version from go.mod | ||
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run linters | ||
run: make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Determine Go version from go.mod | ||
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run tests | ||
run: make test | ||
- name: Upload code coverage report to Code Climate | ||
uses: paambaati/codeclimate-action@v2.7.5 | ||
env: | ||
CC_TEST_REPORTER_ID: 38a41dde51e26878e774848c2654bba1082ad39703571505e877575b2a9695e3 | ||
with: | ||
coverageLocations: cover.out:gocov | ||
prefix: github.com/${{ github.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ | |
# Binaries and dists | ||
/fronius-exporter | ||
/dist | ||
/.github/release-notes.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
.PHONY: build fmt dist clean test run | ||
SHELL := /usr/bin/env bash | ||
|
||
build: fmt | ||
# Disable built-in rules | ||
MAKEFLAGS += --no-builtin-rules | ||
MAKEFLAGS += --no-builtin-variables | ||
.SUFFIXES: | ||
.SECONDARY: | ||
|
||
include Makefile.vars.mk | ||
|
||
.DEFAULT_GOAL := help | ||
.PHONY: help | ||
help: ## Show this help | ||
@grep -E -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = "(: ).*?## "}; {gsub(/\\:/,":",$$1)}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: build | ||
build: export GOOS = linux | ||
build: fmt vet ## Build the Go binary | ||
@go build . | ||
|
||
fmt: | ||
@[[ -z $$(go fmt ./...) ]] | ||
.PHONY: fmt | ||
fmt: ## Run 'go fmt' against code | ||
go fmt ./... | ||
|
||
.PHONY: vet | ||
vet: ## Run 'go vet' against code | ||
go vet ./... | ||
|
||
.PHONY: lint | ||
lint: fmt vet ## Invokes the fmt and vet targets | ||
@echo 'Check for uncommitted changes ...' | ||
git diff --exit-code | ||
|
||
dist: fmt | ||
@goreleaser release --snapshot --rm-dist --skip-sign | ||
.PHONY: build\:docker | ||
build\:docker: export CGO_ENABLED = 0 | ||
build\:docker: | ||
build\:docker: build ## Build the docker image | ||
docker build . -t $(DOCKER_IMG) -t $(QUAY_IMG) | ||
|
||
clean: | ||
@rm -rf fronius-exporter c.out dist | ||
.PHONY: clean | ||
clean: ## Clean the project | ||
@rm -rf fronius-exporter cover.out dist | ||
|
||
test: | ||
@go test -coverprofile c.out ./... | ||
.PHONY: test | ||
test: ## Run unit tests | ||
@go test -coverprofile cover.out ./... | ||
|
||
run: | ||
.PHONY: run | ||
run: ## Run locally | ||
@go run . -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# These are some common variables for Make | ||
|
||
IMG_TAG ?= latest | ||
|
||
# Image URL to use all building/pushing image targets | ||
DOCKER_IMG ?= docker.io/ccremer/fronius-exporter:$(IMG_TAG) | ||
QUAY_IMG ?= quay.io/ccremer/fronius-exporter:$(IMG_TAG) |
Oops, something went wrong.