Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/dependabot-2.0.json
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
version: 2

updates:
- package-ecosystem: github-actions
open-pull-requests-limit: 1
commit-message: { prefix: chore(deps) }
commit-message: { prefix: 'chore(deps)' }
directory: '/'
schedule:
day: sunday
interval: weekly
timezone: Europe/Berlin
groups:
github-actions:
patterns: [ '*' ]
cooldown:
default-days: 1
include: [ '*' ]

- package-ecosystem: gomod
open-pull-requests-limit: 1
commit-message: { prefix: chore(deps) }
commit-message: { prefix: 'sec(deps)' }
directories: [ '**/*' ]
schedule:
day: sunday
interval: weekly
timezone: Europe/Berlin
interval: daily
groups:
security:
applies-to: security-updates
update-types: [ minor, patch ]
patterns: [ '*' ]
updates:
applies-to: version-updates
update-types: [ minor, patch ]
patterns: [ '*' ]
ignore:
- dependency-name: '*'
update-types: [ 'version-update:semver-major' ]
Expand All @@ -43,4 +31,3 @@ updates:
semver-major-days: 14
semver-minor-days: 7
semver-patch-days: 1
include: [ '*' ]
39 changes: 26 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
.*
*.zip
*.tar
*.out
*.log
/bin/
/tmp/
*.pid
*.retry
*.out
*.tgz
*.zip
*.pem
bin/
tmp/

## Git
!.gitkeep
!.gitignore
!.gitattributes

## GitHub
!.github/

## Mise
!.mise.toml

## Lefthook
!.lefthook.yaml

## VSCode
!.vscode/
.vscode/*
!.vscode/extensions.json
!.vscode/settings.default.json

## Editorconfig
!.editorconfig

## Husky
!.husky/
!.husky.yaml

## Golang
go.work
go.work.sum
!.golangci.yml
!.goreleaser.yml
!.golangci.yaml
!.goreleaser.yaml

## Mise
!.mise.toml
## Vitepress
node_modules/
!docs/.vitepress
15 changes: 0 additions & 15 deletions .husky.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/applypatch-msg

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/commit-msg

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/fsmonitor-watchman

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/post-update

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-applypatch

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-commit

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-merge-commit

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-push

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-rebase

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-receive

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/prepare-commit-msg

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/push-to-checkout

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/sendemail-validate

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/update

This file was deleted.

44 changes: 44 additions & 0 deletions .lefthook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/evilmartians/lefthook/refs/heads/master/schema.json
# https://lefthook.dev/configuration/
output: [ summary ]

pre-commit:
skip: [ merge, rebase ]
parallel: true
commands:
branch-name:
run: |
branch_name=$(git rev-parse --abbrev-ref HEAD)
if ! [[ "$branch_name" =~ ^(feature|fix)/ ]]; then
echo "Error: Branch name must start with 'feature/' or 'fix/'. Your branch: $branch_name"
exit 1
fi
golangci-fmt:
glob: "*.go"
run: golangci-lint fmt {staged_files}
stage_fixed: true
golangci-lint:
glob: "*.go"
run: golangci-lint run --new --fast-only
stage_fixed: true

commit-msg:
skip: [ merge, rebase ]
commands:
commit:
run: |
commit_msg_file={1}
commit_msg=$(cat "$commit_msg_file")
# Regex for conventional commits (type(scope?): subject)
regex="^(build|chore|ci|docs|feat|fix|perf|refactor|style|test|sec|wip|revert)(\([a-z0-9\-]+\))?(!)?: .{1,50}"
if ! echo "$commit_msg" | grep -qE "$regex"; then
echo "Error: Commit message does not follow Conventional Commits format."
echo "Format: type(scope?): subject"
echo "Example: feat(login): add remember me option"
exit 1
fi

post-checkout:
commands:
mise:
run: mise -q install
8 changes: 4 additions & 4 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tools]
# https://github.com/golangci/golangci-lint/releases
golangci-lint = "2.7.2"
# https://github.com/go-courier/husky/releases
"github:go-courier/husky" = "1.8.1"
# https://mise-tools.jdx.dev/tools/lefthook
lefthook = "2.1.0"
# https://mise-tools.jdx.dev/tools/golangci-lint
golangci-lint = "2.9.0"
47 changes: 32 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DEFAULT_GOAL:=help
-include .makerc

# --- Config -----------------------------------------------------------------
# --- Config ------------------------------------------------------------------

GOMODS=$(shell find . -type f -name go.mod)
# Newline hack for error output
Expand All @@ -13,7 +13,7 @@ endef
# --- Targets -----------------------------------------------------------------

# This allows us to accept extra arguments
%: .mise .husky go.work
%: .mise .lefthook go.work
@:

# Ensure go.work file
Expand All @@ -25,17 +25,15 @@ go.work:

.PHONY: .mise
# Install dependencies
.mise: msg := $(br)$(br)Please ensure you have 'mise' installed and activated!$(br)$(br)$$ brew update$(br)$$ brew install mise$(br)$(br)See the documentation: https://mise.jdx.dev/getting-started.html$(br)$(br)
.mise:
ifeq (, $(shell command -v mise))
$(error ${msg})
$(error $(br)$(br)Please ensure you have 'mise' installed and activated!$(br)$(br) $$ brew update$(br) $$ brew install mise$(br)$(br)See the documentation: https://mise.jdx.dev/getting-started.html)
endif
@mise install

.PHONY: .husky
# Configure git hooks for husky
.husky:
@git config core.hooksPath .husky
# Configure git hooks for lefthook
.lefthook:
@lefthook install --reset-hooks-path

### Tasks

Expand All @@ -56,16 +54,34 @@ lint:
@$(foreach mod,$(GOMODS), (cd $(dir $(mod)) && echo "πŸ“‚ $(dir $(mod))" && golangci-lint run) &&) true

.PHONY: lint.fix
## Fix lint violations
## Run golangci-lint & fix
lint.fix:
@echo "〉golangci-lint run fix"
@$(foreach mod,$(GOMODS), (cd $(dir $(mod)) && echo "πŸ“‚ $(dir $(mod))" && golangci-lint run --fix) &&) true

.PHONY: generate
## Run go generate
generate:
@echo "〉go generate"
@go generate ./...

.PHONY: test
## Run tests
## Run go tests
test:
@echo "〉go test"
@GO_TEST_TAGS=-skip go test -coverprofile=coverage.out -tags=safe -race work
@GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out work

.PHONY: test.race
## Run go tests with `race` flag
test.race:
@echo "〉go test with -race"
@GO_TEST_TAGS=-skip,race go test -tags=safe -coverprofile=coverage.out -race work

.PHONY: test.update
## Run go tests with `update` flag
test.update:
@echo "〉go test with -update"
@GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -update work

.PHONY: outdated
## Show outdated direct dependencies
Expand All @@ -83,17 +99,18 @@ release:
@find . -type f -name 'go.mod' -mindepth 2 -not -path './examples/*' -not -path './vendor/*' -exec sh -c 'dir=$$(dirname {} | sed "s|^\./||"); tag="$$dir/v$(TAG)"; git rev-parse "$$tag" >/dev/null 2>&1 || { echo "πŸ”– $$tag"; git tag "$$tag"; }' \;
@echo "πŸ“¦ Creating main tag..."
@echo "πŸ”– v$(TAG)" && git tag "v$(TAG)"
@echo "βœ… Tags created:" && git tag -l "*$(TAG)"
@read -p "Push tags? [y/N] " yn; case $$yn in [Yy]*) git push origin --tags;; esac

### Utils
### Documentation

.PHONY: docs
.PHONY: godocs
## Open go docs
docs:
godocs:
@echo "〉starting go docs"
@go doc -http

### Utils

.PHONY: help
## Show help text
help:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![GoDoc](https://godoc.org/github.com/foomo/keel?status.svg)](https://godoc.org/github.com/foomo/keel)

<p align="center">
<img alt="sesamy" src="docs/public/keel.png"/>
<img alt="keel" src="docs/public/keel.png" width="400" height="400"/>
</p>

# keel
Expand Down
Loading
Loading