Skip to content

Commit

Permalink
ci: add some tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaro committed Aug 31, 2022
1 parent 53bb5c6 commit c2e3a96
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 26 deletions.
42 changes: 42 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
28 changes: 28 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/nikaro/zabbixmon
options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
30 changes: 16 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "^vendor/"
exclude: ^vendor/
repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.3.0"
hooks:
- id: "trailing-whitespace"
- id: "end-of-file-fixer"
- id: "check-yaml"
- id: "check-added-large-files"
- repo: "https://github.com/golangci/golangci-lint"
rev: "v1.48.0"
hooks:
- id: "golangci-lint"
- hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
- hooks:
- id: golangci-lint
repo: https://github.com/golangci/golangci-lint
rev: v1.48.0
- hooks:
- id: commitizen
repo: https://github.com/commitizen-tools/commitizen
rev: v2.32.2
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<a name="unreleased"></a>
## [Unreleased]


<a name="v1.0.1"></a>
## [v1.0.1] - 2022-08-08
### Bug Fixes
- don't read config for man/completion commands

### Code Refactoring
- add JSON() method on wgPeer


<a name="v1.0.0"></a>
## [v1.0.0] - 2022-06-12

<a name="v0.1.3"></a>
## [v0.1.3] - 2020-07-07

<a name="v0.1.1"></a>
## [v0.1.1] - 2020-06-15

<a name="v0.1.0"></a>
## v0.1.0 - 2020-06-12

[Unreleased]: https://github.com/nikaro/zabbixmon/compare/v1.0.1...HEAD
[v1.0.1]: https://github.com/nikaro/zabbixmon/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/nikaro/zabbixmon/compare/v0.1.3...v1.0.0
[v0.1.3]: https://github.com/nikaro/zabbixmon/compare/v0.1.1...v0.1.3
[v0.1.1]: https://github.com/nikaro/zabbixmon/compare/v0.1.0...v0.1.1
23 changes: 11 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ setup:
build:
@echo "Building..."
env CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -mod vendor -o build/${APP}-${GOOS}-${GOARCH} .
build/${APP}-${GOOS}-${GOARCH} man > man/wirelogd.1

.PHONY: man
## man: Build manpage
man:
@echo "Building manpage..."
build/${APP}-${GOOS}-${GOARCH} man > man/${APP}.1

.PHONY: completion
## man: Build completions
completion:
@echo "Building completions..."
build/${APP}-${GOOS}-${GOARCH} completion bash > completions/${APP}.bash
build/${APP}-${GOOS}-${GOARCH} completion fish > completions/${APP}.fish
build/${APP}-${GOOS}-${GOARCH} completion zsh > completions/${APP}.zsh

.PHONY: build-all
## build-all: Build for all targets
build-all:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(MAKE) build
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(MAKE) build

.PHONY: install
## install: Install the application
install:
Expand Down Expand Up @@ -86,11 +90,6 @@ test:
@echo "Testing..."
go test ./...

.PHONY: man
## man: Build manpage
man:
@echo "TODO"

.PHONY: run
## run: Runs go run
run:
Expand Down

0 comments on commit c2e3a96

Please sign in to comment.