Skip to content

Commit 6871b87

Browse files
committed
ci: add commitlint, dependabot, issue templates, PR template, and golangci-lint
1 parent 5392b6e commit 6871b87

9 files changed

Lines changed: 161 additions & 25 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Bug Report
2+
description: Report a bug or unexpected behavior
3+
labels: [bug]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: Description
9+
description: What happened?
10+
placeholder: A clear description of the bug
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: reproduction
15+
attributes:
16+
label: Steps to Reproduce
17+
description: How can we reproduce this?
18+
placeholder: |
19+
1. Run `stacktower parse ...`
20+
2. See error
21+
validations:
22+
required: true
23+
- type: textarea
24+
id: expected
25+
attributes:
26+
label: Expected Behavior
27+
description: What did you expect to happen?
28+
validations:
29+
required: false
30+
- type: input
31+
id: version
32+
attributes:
33+
label: Version
34+
description: Output of `stacktower --version`
35+
placeholder: "v0.1.0"
36+
validations:
37+
required: true
38+
- type: dropdown
39+
id: os
40+
attributes:
41+
label: Operating System
42+
options:
43+
- macOS
44+
- Linux
45+
- Windows
46+
validations:
47+
required: true
48+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Feature Request
2+
description: Suggest an idea or improvement
3+
labels: [enhancement]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: Description
9+
description: What would you like to see?
10+
placeholder: A clear description of the feature
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: use-case
15+
attributes:
16+
label: Use Case
17+
description: Why do you need this? What problem does it solve?
18+
validations:
19+
required: false
20+
- type: textarea
21+
id: alternatives
22+
attributes:
23+
label: Alternatives Considered
24+
description: Have you considered any workarounds or alternatives?
25+
validations:
26+
required: false
27+

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Description
2+
3+
<!-- What does this PR do? -->
4+
5+
## Checklist
6+
7+
- [ ] Tests pass (`make test`)
8+
- [ ] Code is formatted (`make fmt`)
9+
- [ ] Lints pass (`make lint`)
10+
- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
11+

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
- package-ecosystem: github-actions
8+
directory: /
9+
schedule:
10+
interval: weekly
11+

.github/workflows/ci.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,14 @@ jobs:
2424
go-version-file: 'go.mod'
2525
cache: true
2626

27-
- name: Format check
28-
run: |
29-
gofmt -s -l . | tee /tmp/gofmt.out
30-
test ! -s /tmp/gofmt.out
31-
32-
- name: Vet
33-
run: go vet ./...
27+
- name: Lint
28+
uses: golangci/golangci-lint-action@v7
29+
with:
30+
version: v2.1.6
3431

3532
- name: Test
3633
run: go test -race -timeout=2m ./...
3734

38-
- name: Staticcheck
39-
uses: dominikh/staticcheck-action@v1
40-
with:
41-
version: latest
42-
install-go: false
43-
4435
- name: Vulncheck
4536
run: |
4637
go install golang.org/x/vuln/cmd/govulncheck@latest

.github/workflows/commitlint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Commitlint
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
commitlint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Check PR title
16+
env:
17+
PR_TITLE: ${{ github.event.pull_request.title }}
18+
run: |
19+
# Conventional commit pattern: type(scope)?: description
20+
pattern='^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\([a-z0-9-]+\))?: .+'
21+
22+
if [[ ! "$PR_TITLE" =~ $pattern ]]; then
23+
echo "❌ PR title does not follow conventional commits format"
24+
echo ""
25+
echo "Expected: <type>: <description>"
26+
echo "Got: $PR_TITLE"
27+
echo ""
28+
echo "Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert"
29+
echo ""
30+
echo "Examples:"
31+
echo " feat: add new feature"
32+
echo " fix: resolve memory leak"
33+
echo " feat(parser): add ruby support"
34+
exit 1
35+
fi
36+
37+
echo "✅ PR title follows conventional commits: $PR_TITLE"
38+

.golangci.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
version: "2"
22

3-
run:
4-
timeout: 5m
5-
tests: false
3+
formatters:
4+
enable:
5+
- gofmt
6+
- goimports
7+
settings:
8+
goimports:
9+
local-prefixes:
10+
- github.com/matzehuels/stacktower
611

712
linters:
13+
default: none
814
enable:
9-
- errcheck
1015
- govet
1116
- staticcheck
1217
- unused
13-
- ineffassign
18+
- misspell
19+
- unconvert
1420

15-
issues:
16-
max-issues-per-linter: 0
17-
max-same-issues: 0
21+
settings:
22+
staticcheck:
23+
checks:
24+
- all
25+
- -ST1000
26+
- -ST1016
27+
- -QF1003

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ fmt:
1111
@goimports -w -local stacktower .
1212

1313
lint:
14-
@go vet ./...
15-
@staticcheck ./...
14+
@golangci-lint run
1615

1716
test:
1817
@go test -race -timeout=2m ./...
@@ -48,7 +47,7 @@ blog-showcase: build
4847
@./scripts/blog_showcase.sh
4948

5049
install-tools:
51-
@go install honnef.co/go/tools/cmd/staticcheck@latest
50+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
5251
@go install golang.org/x/tools/cmd/goimports@latest
5352
@go install golang.org/x/vuln/cmd/govulncheck@latest
5453

@@ -68,7 +67,7 @@ help:
6867
@echo "make - Run checks and build"
6968
@echo "make check - Format, lint, test"
7069
@echo "make fmt - Format code"
71-
@echo "make lint - Run go vet and staticcheck"
70+
@echo "make lint - Run golangci-lint"
7271
@echo "make test - Run tests"
7372
@echo "make cover - Run tests with coverage"
7473
@echo "make build - Build binary"

internal/cli/ordering.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"time"
77

88
"github.com/charmbracelet/log"
9+
910
"github.com/matzehuels/stacktower/pkg/dag"
1011
"github.com/matzehuels/stacktower/pkg/render/tower/ordering"
1112
)

0 commit comments

Comments
 (0)