Skip to content

Commit e6c1c2d

Browse files
elhimovbigbes
authored andcommitted
ci: setup base ci
Closes TNTP-4169
1 parent e023090 commit e6c1c2d

File tree

9 files changed

+256
-0
lines changed

9 files changed

+256
-0
lines changed

.codespellrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[codespell]
2+
3+
skip = ./vendor,./.git
4+
# ignore-words-list =
5+
check-filenames = true

.github/pull_request_template.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
What has been done? Why? What problem is being solved?
2+
3+
I didn't forget about (remove if it is not applicable):
4+
5+
- [ ] Well-written commit messages (see [documentation][how-to-write-commit] how to write a commit message)
6+
- [ ] Don't forget about TarantoolBot in a commit message (see [example][tarantoolbot-example])
7+
- [ ] Tests (see [documentation][go-testing] for a testing package)
8+
- [ ] Changelog (see [documentation][keepachangelog] for changelog format)
9+
- [ ] Documentation (see [documentation][go-doc] for documentation style guide)
10+
11+
Related issues:
12+
13+
Related to #XXX
14+
15+
Part of #XXX
16+
17+
Closes #XXX
18+
19+
[go-doc]: https://go.dev/blog/godoc
20+
[go-testing]: https://pkg.go.dev/testing
21+
[how-to-write-commit]: https://www.tarantool.io/en/doc/latest/contributing/developer_guidelines/#how-to-write-a-commit-message
22+
[keepachangelog]: https://keepachangelog.com/en/1.0.0/
23+
[tarantoolbot-example]: https://github.com/tarantool/tt/pull/1030/commits

.github/workflows/check.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Run checks
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
GO_VERSION: 1.24
9+
CODESPELL_VERSION: v2.4.1
10+
11+
jobs:
12+
golangci-lint:
13+
runs-on: ubuntu-latest
14+
if: |
15+
github.event_name == 'push' ||
16+
github.event_name == 'pull_request' &&
17+
github.event.pull_request.head.repo.full_name != github.repository
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-go@v5
22+
with:
23+
go-version: ${{ env.GO_VERSION }}
24+
25+
- uses: golangci/golangci-lint-action@v8
26+
name: run golangci-lint with gha format
27+
continue-on-error: true
28+
29+
- uses: golangci/golangci-lint-action@v8
30+
name: run golangci-lint with human-readable format
31+
32+
codespell:
33+
runs-on: ubuntu-latest
34+
if: |
35+
github.event_name == 'push' ||
36+
github.event_name == 'pull_request' &&
37+
github.event.pull_request.head.repo.full_name != github.repository
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: install codespell
43+
run: pip3 install codespell==${CODESPELL_VERSION}
44+
45+
- name: run codespell
46+
run: make codespell
47+
48+
verify-generation:
49+
runs-on: ubuntu-latest
50+
if: |
51+
github.event_name == 'push' ||
52+
github.event_name == 'pull_request' &&
53+
github.event.pull_request.head.repo.full_name != github.repository
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: actions/setup-go@v5
58+
with:
59+
go-version: ${{ env.GO_VERSION }}
60+
61+
- name: generate code
62+
run: go generate ./...
63+
64+
- name: check for changes
65+
run: |
66+
if [ -n "$(git status --porcelain)" ]; then
67+
echo "new files were generated"
68+
git status --porcelain
69+
git diff
70+
exit 1
71+
fi

.github/workflows/testing.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: testing
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
run-tests:
10+
if: (github.event_name == 'push') ||
11+
(github.event_name == 'pull_request' &&
12+
github.event.pull_request.head.repo.full_name != github.repository) ||
13+
(github.event_name == 'workflow_dispatch')
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
golang: ['1.23', '1.24', 'stable']
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version: ${{ matrix.golang }}
27+
28+
- name: run tests
29+
run: make test
30+
31+
- name: run tests with race
32+
run: make testrace
33+
34+
run-tests-with-coverage:
35+
if: (github.event_name == 'push') ||
36+
(github.event_name == 'pull_request' &&
37+
github.event.pull_request.head.repo.full_name != github.repository) ||
38+
(github.event_name == 'workflow_dispatch')
39+
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ matrix.golang }}
47+
48+
- name: run tests, collect code coverage data and send to Coveralls
49+
env:
50+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: make coverage coveralls-deps coveralls
52+
53+
run-benchmarks:
54+
if: false
55+
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: actions/setup-go@v5
61+
with:
62+
go-version: ${{ matrix.golang }}
63+
- name: run benchmarks
64+
run: make bench
65+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage.out

.golangci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
version: '2'
2+
3+
run:
4+
timeout: 3m
5+
6+
formatters:
7+
enable:
8+
- goimports
9+
10+
linters:
11+
default: all
12+
13+
disable:
14+
- dupl # Dupl is disabled, since we're generating a lot of boilerplate code.
15+
- cyclop # Cyclop is disabled, since cyclomatic complexities is very abstract metric,
16+
# that sometimes lead to strange linter behaviour.
17+
- wsl # WSL is disabled, since it's obsolete. Using WSL_v5.
18+
- nlreturn # nlreturn is disabled, since it's duplicated by wsl_v5.return check.
19+
- ireturn # ireturn is disabled, since it's not needed.
20+
21+
exclusions:
22+
generated: lax
23+
rules:
24+
- path: _test.go
25+
linters:
26+
- wrapcheck
27+
28+
settings:
29+
godot:
30+
scope: all
31+
lll:
32+
line-length: 120
33+
tab-width: 4
34+
wsl_v5:
35+
allow-first-in-block: true
36+
allow-whole-block: false
37+
branch-max-lines: 2
38+
case-max-lines: 0
39+
default: all
40+
depguard:
41+
rules:
42+
main:
43+
files:
44+
- "$all"
45+
- "!$test"
46+
allow:
47+
- $gostd
48+
test:
49+
files:
50+
- "$test"
51+
allow:
52+
- $gostd
53+
- "github.com/stretchr/testify"

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
GOTEST := go test
2+
TAGS :=
3+
COVERAGE_FILE := coverage.out
4+
5+
.PHONY: codespell
6+
codespell:
7+
@echo "Running codespell"
8+
@codespell
9+
10+
.PHONY: test
11+
test:
12+
@echo "Running tests"
13+
@go test ./... -count=1
14+
15+
.PHONY: testrace
16+
testrace:
17+
@echo "Running tests with race flag"
18+
@go test ./... -count=100 -race
19+
20+
.PHONY: coverage
21+
coverage:
22+
@echo "Running tests with coveralls"
23+
go test -tags "$(TAGS)" $(go list ./... | grep -v test_helpers) -v -p 1 -covermode=atomic -coverprofile=$(COVERAGE_FILE) -count=1
24+
go tool cover -func=$(COVERAGE_FILE)
25+
26+
.PHONY: coveralls
27+
coveralls:
28+
@echo "uploading coverage to coveralls"
29+
@goveralls -coverprofile=$(COVERAGE_FILE) -service=github
30+
31+
.PHONY: coveralls-deps
32+
coveralls-deps:
33+
@echo "Installing coveralls"
34+
@go get github.com/mattn/goveralls
35+
@go install github.com/mattn/goveralls

doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package storage provides a uniform way to handle various types of
2+
// centralized config storages for Tarantool.
3+
package storage

go.sum

Whitespace-only changes.

0 commit comments

Comments
 (0)