Skip to content

Commit 8f5ab09

Browse files
committed
Hello world, GRIT!
1 parent c8946c1 commit 8f5ab09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+6784
-0
lines changed

.github/workflows/go-main.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Go Main
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
Build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Go
14+
uses: actions/setup-go@v4
15+
with:
16+
go-version: '1.24.0'
17+
18+
- name: Build
19+
run: make build
20+
21+
- name: Test
22+
run: make test-with-coverage
23+
24+
- name: Archive code coverage results
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: code-coverage
28+
path: coverage.out
29+
30+
Lint:
31+
name: lint
32+
runs-on: ubuntu-latest
33+
needs: Build
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-go@v5
37+
with:
38+
go-version: '1.24.0'
39+
- name: golangci-lint
40+
uses: golangci/golangci-lint-action@v6
41+
with:
42+
version: v1.62

.github/workflows/go-pr.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Go PR
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
types: [opened, reopened, synchronize]
7+
8+
jobs:
9+
Build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v4
16+
with:
17+
go-version: '1.24.0'
18+
19+
- name: Build
20+
run: make build
21+
22+
- name: Test
23+
run: make test-with-coverage
24+
25+
- name: Archive code coverage results
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: code-coverage
29+
path: coverage.out
30+
31+
Lint:
32+
name: lint
33+
runs-on: ubuntu-latest
34+
needs: Build
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-go@v5
38+
with:
39+
go-version: '1.24.0'
40+
- name: golangci-lint
41+
uses: golangci/golangci-lint-action@v6
42+
with:
43+
version: v1.62

.github/workflows/release.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.24.0'
23+
- name: Run GoReleaser
24+
uses: goreleaser/goreleaser-action@v6
25+
with:
26+
distribution: goreleaser
27+
version: "~> v2"
28+
args: release --clean
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*.dll
88
*.so
99
*.dylib
10+
grit/grit.exe
11+
grit/grit
1012

1113
# Test binary, built with `go test -c`
1214
*.test
@@ -23,3 +25,22 @@ go.work.sum
2325

2426
# env file
2527
.env
28+
29+
# IDE
30+
.vscode
31+
.idea
32+
33+
# Development tmp folder
34+
dev_data
35+
test_data
36+
plots
37+
38+
# Test results
39+
testdata/charts
40+
41+
# Goreleaser
42+
dist
43+
44+
# Go coverage
45+
coverage.out
46+
coverage.html

.golangci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
linters:
2+
enable-all: true
3+
disable:
4+
- depguard
5+
- godox
6+
- gci
7+
- tenv
8+
- testpackage
9+
- gochecknoglobals # store global configuration values
10+
- forbidigo # use printf for showing progress information and verbose output
11+
- gochecknoinits # init functions to setup cobra commands
12+
- nolintlint
13+
- exhaustruct
14+
linters-settings:
15+
gocritic:
16+
enable-all: true
17+
disabled-checks:
18+
- commentedOutCode # disable in early pre 1.0.0 versions
19+
funlen:
20+
lines: 60
21+
statements: 40
22+
ignore-comments: true
23+
paralleltest:
24+
ignore-missing: true
25+
nestif:
26+
min-complexity: 8
27+
28+
issues:
29+
exclude-rules:
30+
- path: _test\.go
31+
linters:
32+
- funlen
33+
- varnamelen
34+
- dupl
35+
exclude-dirs:
36+
- testdata # test code directory

.goreleaser.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
version: 2
2+
3+
project_name: grit
4+
5+
before:
6+
hooks:
7+
- go mod tidy
8+
9+
builds:
10+
- binary: grit
11+
main: ./grit
12+
env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- linux
16+
- windows
17+
- darwin
18+
goarch:
19+
- amd64
20+
- arm64
21+
- riscv64
22+
23+
archives:
24+
- format: tar.gz
25+
wrap_in_directory: true
26+
format_overrides:
27+
- goos: windows
28+
format: zip
29+
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
30+
files:
31+
- LICENSE
32+
- README.md
33+
34+
snapshot:
35+
version_template: SNAPSHOT-{{ .Commit }}
36+
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- "^docs:"
42+
- "^test:"
43+
- Merge pull request
44+
- Merge branch
45+
46+
source:
47+
enabled: true
48+
name_template: '{{ .ProjectName }}-{{ .Version }}-source'
49+
50+
release:
51+
github:
52+
owner: vbvictor
53+
name: grit
54+
header: |
55+
`grit` is a free and open-source cli tool that helps developers understand their codebase maintainability index.
56+
57+
nfpms:
58+
- id: grit-nfpms
59+
package_name: grit
60+
file_name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
61+
homepage: https://github.com/vbvictor/grit
62+
maintainer: "Victor Baranov <https://github.com/vbvictor>"
63+
description: cli tool that helps developers understand their codebase maintainability index
64+
license: MIT
65+
section: golang
66+
formats:
67+
- deb
68+
- rpm
69+
umask: 0o022
70+
overrides:
71+
deb:
72+
contents:
73+
- src: LICENSE
74+
dst: /usr/share/doc/grit/copyright
75+
- src: README.md
76+
dst: /usr/share/doc/grit/README.md
77+
recommends:
78+
- golang-go
79+
rpm:
80+
contents:
81+
- src: LICENSE
82+
dst: /usr/share/doc/grit/LICENSE
83+
- src: README.md
84+
dst: /usr/share/doc/grit/README.md
85+
recommends:
86+
- /usr/bin/go
87+
rpm:
88+
group: Development/Tools

.testcoverage.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
profile: coverage.out
2+
3+
local-prefix: "github.com/vbvictor/grit"

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.PHONY: all build test clean lint vet fmt run
2+
3+
all: build lint test install
4+
5+
grit:
6+
go build -o grit ./grit
7+
8+
build:
9+
go build ./...
10+
go build -o grit ./grit
11+
12+
install:
13+
go install ./grit
14+
15+
test:
16+
go test -v ./...
17+
18+
test-with-coverage:
19+
go test -v -cover -coverprofile=coverage.out ./...
20+
21+
clean:
22+
go clean
23+
rm -f coverage.out
24+
25+
lint:
26+
golangci-lint run
27+
28+
format:
29+
gofumpt -w .
30+
31+
coverage:
32+
go test -v -cover -coverprofile=coverage.out ./...
33+
go tool cover -html=coverage.out
34+
35+
deps:
36+
go mod download
37+
go mod tidy

0 commit comments

Comments
 (0)