chore(ci): add linting, formatting, and CI pipeline #170

Merged
fuzzy merged 12 commits from chore/ci-linting-config into main 2026-07-06 06:38:29 +00:00
Owner

What

Add comprehensive linting, formatting, and CI configuration for the ttheart project:

  • .pre-commit-config.yaml — automated pre-commit hooks (formatting, vetting, validation)
  • .golangci-lint.yml — static analysis with ~35 enabled linters
  • .forgejo/workflows/ci.yml — Forgejo Actions CI pipeline running on all PRs and pushes to main

Why

Enforce code quality and consistency from the start. All changes must pass pre-commit hooks, golangci-lint, and tests before merge. Catches bugs, style violations, and security issues early.

Testing

  • Unit tests pass
  • Integration tests pass
  • Manual testing performed — configs validated against schema
  • New tests added for new functionality — N/A (config-only change)

Breaking Changes

None.

Notes

  • CI uses 3 parallel jobs: pre-commit, lint, and test
  • Go 1.24 for all jobs
  • golangci-lint v1.64 with timeout of 5 minutes
  • Test files get leniency on errcheck, gosec, funlen, gocyclo, gocognit
  • Pre-commit hooks include forgejo-runner-validate for workflow file validation
## What Add comprehensive linting, formatting, and CI configuration for the ttheart project: - `.pre-commit-config.yaml` — automated pre-commit hooks (formatting, vetting, validation) - `.golangci-lint.yml` — static analysis with ~35 enabled linters - `.forgejo/workflows/ci.yml` — Forgejo Actions CI pipeline running on all PRs and pushes to main ## Why Enforce code quality and consistency from the start. All changes must pass pre-commit hooks, golangci-lint, and tests before merge. Catches bugs, style violations, and security issues early. ## Testing - [ ] Unit tests pass - [ ] Integration tests pass - [ ] Manual testing performed — configs validated against schema - [ ] New tests added for new functionality — N/A (config-only change) ## Breaking Changes None. ## Notes - CI uses 3 parallel jobs: pre-commit, lint, and test - Go 1.24 for all jobs - golangci-lint v1.64 with timeout of 5 minutes - Test files get leniency on errcheck, gosec, funlen, gocyclo, gocognit - Pre-commit hooks include forgejo-runner-validate for workflow file validation
chore(ci): add Forgejo Actions CI workflow
Some checks failed
CI / Pre-commit Hooks (pull_request) Has been cancelled
CI / Lint (golangci-lint) (pull_request) Has been cancelled
CI / Test (pull_request) Has been cancelled
9a479772cb
fix(ci): use ubuntu-latest runner label
Some checks failed
CI / Lint (golangci-lint) (pull_request) Failing after 4s
CI / Pre-commit Hooks (pull_request) Failing after 24s
CI / Test (pull_request) Failing after 23s
968aa271f1
fix(ci): install golangci-lint via script instead of action
Some checks failed
CI / Pre-commit Hooks (pull_request) Failing after 28s
CI / Lint (golangci-lint) (pull_request) Failing after 29s
CI / Test (pull_request) Failing after 22s
ee4bb71f9b
fix(ci): install golangci-lint via action
Some checks failed
CI / Pre-commit Hooks (pull_request) Failing after 28s
CI / Lint (golangci-lint) (pull_request) Failing after 44s
CI / Test (pull_request) Failing after 22s
8bec5b99b7
fix(ci): use system python3 for pre-commit install
Some checks failed
CI / Pre-commit Hooks (pull_request) Failing after 26s
CI / Lint (golangci-lint) (pull_request) Failing after 30s
CI / Test (pull_request) Failing after 23s
bccc1502fa
fix(ci): install python3-pip before pre-commit
Some checks failed
CI / Lint (golangci-lint) (pull_request) Failing after 31s
CI / Pre-commit Hooks (pull_request) Failing after 35s
CI / Test (pull_request) Failing after 23s
ca27816223
fix(ci): install pre-commit via apt
Some checks failed
CI / Lint (golangci-lint) (pull_request) Failing after 30s
CI / Pre-commit Hooks (pull_request) Failing after 43s
CI / Test (pull_request) Failing after 20s
1975616a11
fix(ci): use correct hook IDs for pre-commit-golang
Some checks failed
CI / Lint (golangci-lint) (pull_request) Failing after 29s
CI / Pre-commit Hooks (pull_request) Successful in 1m31s
CI / Test (pull_request) Failing after 27s
7df400cc8b
fix(ci): skip lint and test jobs when go.mod is missing
Some checks failed
CI / Lint (golangci-lint) (pull_request) Failing after 1s
CI / Test (pull_request) Failing after 0s
CI / Pre-commit Hooks (pull_request) Has been cancelled
f641fbc9f9
fix(ci): use step outputs for go.mod check instead of hashFiles
All checks were successful
CI / Lint (golangci-lint) (pull_request) Successful in 24s
CI / Test (pull_request) Successful in 23s
CI / Pre-commit Hooks (pull_request) Successful in 1m23s
CI / Lint (golangci-lint) (push) Successful in 25s
CI / Test (push) Successful in 25s
CI / Pre-commit Hooks (push) Successful in 1m21s
e778bf2e9c
the.auditor left a comment

Review complete. Solid CI foundation — well-structured jobs, sensible linter selection, good test coverage setup. No blocking issues found.

Suggestions

  1. .forgejo/workflows/ci.yml:31 – Pre-commit job missing golangci-lint binary. The local golangci-lint hook will fail once .go files are added. Fix: add SKIP=golangci-lint env var to the pre-commit step (lint job covers this separately). Filed as #171.

  2. .golangci-lint.yml:132forbidigo in exclude-rules but linter not enabled. Dead config entry. Filed as #172.

Praise

  • Excellent linter selection (~35 linters) with sensible exclusions for test files
  • CI guards on go.mod existence are clean — won't fail pre-emptively
  • Using $FORGEJO_OUTPUT correctly for Forgejo Actions output passing
  • Test job with -race -coverprofile -covermode=atomic covers race detection and coverage
  • Pre-commit hooks are well-chosen (trailing-whitespace, yaml validation, Go toolchain, forgejo-runner-validate)
Review complete. Solid CI foundation — well-structured jobs, sensible linter selection, good test coverage setup. No blocking issues found. ## Suggestions 1. `.forgejo/workflows/ci.yml:31` – Pre-commit job missing golangci-lint binary. The local `golangci-lint` hook will fail once `.go` files are added. Fix: add `SKIP=golangci-lint` env var to the pre-commit step (lint job covers this separately). Filed as #171. 2. `.golangci-lint.yml:132` – `forbidigo` in exclude-rules but linter not enabled. Dead config entry. Filed as #172. ## Praise - Excellent linter selection (~35 linters) with sensible exclusions for test files - CI guards on `go.mod` existence are clean — won't fail pre-emptively - Using `$FORGEJO_OUTPUT` correctly for Forgejo Actions output passing - Test job with `-race -coverprofile -covermode=atomic` covers race detection and coverage - Pre-commit hooks are well-chosen (trailing-whitespace, yaml validation, Go toolchain, forgejo-runner-validate)
the.auditor left a comment

Re-review: no blocking issues found across all three config files. CI pipeline is well-structured, linter selection is comprehensive, pre-commit hooks are appropriate for the project. The two suggestions filed (#171, #172) are non-blocking future-proofing items.

APPROVED

Re-review: no blocking issues found across all three config files. CI pipeline is well-structured, linter selection is comprehensive, pre-commit hooks are appropriate for the project. The two suggestions filed (#171, #172) are non-blocking future-proofing items. **APPROVED**
fuzzy merged commit e778bf2e9c into main 2026-07-06 06:38:29 +00:00
fuzzy deleted branch chore/ci-linting-config 2026-07-06 06:38:29 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/ttheart!170
No description provided.