diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..276740c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,48 @@ +name: Bug Report +description: Report a bug or unexpected behavior +labels: [bug] +body: + - type: textarea + id: description + attributes: + label: Description + description: What happened? + placeholder: A clear description of the bug + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Steps to Reproduce + description: How can we reproduce this? + placeholder: | + 1. Run `stacktower parse ...` + 2. See error + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected Behavior + description: What did you expect to happen? + validations: + required: false + - type: input + id: version + attributes: + label: Version + description: Output of `stacktower --version` + placeholder: "v0.1.0" + validations: + required: true + - type: dropdown + id: os + attributes: + label: Operating System + options: + - macOS + - Linux + - Windows + validations: + required: true + diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..a7187c7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,27 @@ +name: Feature Request +description: Suggest an idea or improvement +labels: [enhancement] +body: + - type: textarea + id: description + attributes: + label: Description + description: What would you like to see? + placeholder: A clear description of the feature + validations: + required: true + - type: textarea + id: use-case + attributes: + label: Use Case + description: Why do you need this? What problem does it solve? + validations: + required: false + - type: textarea + id: alternatives + attributes: + label: Alternatives Considered + description: Have you considered any workarounds or alternatives? + validations: + required: false + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..9bb8b41 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +## Description + + + +## Checklist + +- [ ] Tests pass (`make test`) +- [ ] Code is formatted (`make fmt`) +- [ ] Lints pass (`make lint`) +- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..56b6002 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: gomod + directory: / + schedule: + interval: weekly + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27dd672..4726013 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,23 +24,14 @@ jobs: go-version-file: 'go.mod' cache: true - - name: Format check - run: | - gofmt -s -l . | tee /tmp/gofmt.out - test ! -s /tmp/gofmt.out - - - name: Vet - run: go vet ./... + - name: Lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest - name: Test run: go test -race -timeout=2m ./... - - name: Staticcheck - uses: dominikh/staticcheck-action@v1 - with: - version: latest - install-go: false - - name: Vulncheck run: | go install golang.org/x/vuln/cmd/govulncheck@latest diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..196c094 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,38 @@ +name: Commitlint + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check PR title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + # Conventional commit pattern: type(scope)?: description + pattern='^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\([a-z0-9-]+\))?: .+' + + if [[ ! "$PR_TITLE" =~ $pattern ]]; then + echo "❌ PR title does not follow conventional commits format" + echo "" + echo "Expected: : " + echo "Got: $PR_TITLE" + echo "" + echo "Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert" + echo "" + echo "Examples:" + echo " feat: add new feature" + echo " fix: resolve memory leak" + echo " feat(parser): add ruby support" + exit 1 + fi + + echo "✅ PR title follows conventional commits: $PR_TITLE" + diff --git a/.golangci.yml b/.golangci.yml index 52ac06e..add9a1b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,17 +1,27 @@ version: "2" -run: - timeout: 5m - tests: false +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - github.com/matzehuels/stacktower linters: + default: none enable: - - errcheck - govet - staticcheck - unused - - ineffassign + - misspell + - unconvert -issues: - max-issues-per-linter: 0 - max-same-issues: 0 + settings: + staticcheck: + checks: + - all + - -ST1000 # package comments + - -ST1016 # receiver names + - -QF1003 # tagged switch suggestion diff --git a/Makefile b/Makefile index ff7cb46..d9b32ed 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,7 @@ fmt: @goimports -w -local stacktower . lint: - @go vet ./... - @staticcheck ./... + @golangci-lint run test: @go test -race -timeout=2m ./... @@ -48,7 +47,7 @@ blog-showcase: build @./scripts/blog_showcase.sh install-tools: - @go install honnef.co/go/tools/cmd/staticcheck@latest + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest @go install golang.org/x/tools/cmd/goimports@latest @go install golang.org/x/vuln/cmd/govulncheck@latest @@ -68,7 +67,7 @@ help: @echo "make - Run checks and build" @echo "make check - Format, lint, test" @echo "make fmt - Format code" - @echo "make lint - Run go vet and staticcheck" + @echo "make lint - Run golangci-lint" @echo "make test - Run tests" @echo "make cover - Run tests with coverage" @echo "make build - Build binary" diff --git a/go.mod b/go.mod index fd09b2e..84a41cb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v1.5.0 github.com/charmbracelet/log v0.4.2 github.com/goccy/go-graphviz v0.2.9 - github.com/spf13/cobra v1.10.1 + github.com/spf13/cobra v1.10.2 ) require ( diff --git a/go.sum b/go.sum index 26acffa..2d49c17 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= -github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -60,6 +60,7 @@ github.com/tetratelabs/wazero v1.10.1 h1:2DugeJf6VVk58KTPszlNfeeN8AhhpwcZqkJj2ww github.com/tetratelabs/wazero v1.10.1/go.mod h1:DRm5twOQ5Gr1AoEdSi0CLjDQF1J9ZAuyqFIjl1KKfQU= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= diff --git a/internal/cli/ordering.go b/internal/cli/ordering.go index 8c08309..9eafe3e 100644 --- a/internal/cli/ordering.go +++ b/internal/cli/ordering.go @@ -6,6 +6,7 @@ import ( "time" "github.com/charmbracelet/log" + "github.com/matzehuels/stacktower/pkg/dag" "github.com/matzehuels/stacktower/pkg/render/tower/ordering" )