-
Notifications
You must be signed in to change notification settings - Fork 0
gha: adding initial files for github actions #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[codespell] | ||
|
||
skip = ./vendor,./.git | ||
# ignore-words-list = | ||
check-filenames = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
What has been done? Why? What problem is being solved? | ||
|
||
I didn't forget about (remove if it is not applicable): | ||
|
||
- [ ] Tests (see [documentation](https://pkg.go.dev/testing) for a testing package) | ||
- [ ] Changelog (see [documentation](https://keepachangelog.com/en/1.0.0/) for changelog format) | ||
- [ ] Documentation (see [documentation](https://go.dev/blog/godoc) for documentation style guide) | ||
|
||
Related issues: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Run checks | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
GO_VERSION: 1.24 | ||
CODESPELL_VERSION: v2.4.1 | ||
|
||
|
||
jobs: | ||
golangci-lint: | ||
oleg-jukovec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'push' || | ||
github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name != github.repository | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- uses: golangci/golangci-lint-action@v8 | ||
name: run golangci-lint with gha format | ||
continue-on-error: true | ||
|
||
- uses: golangci/golangci-lint-action@v8 | ||
name: run golangci-lint with human-readable format | ||
|
||
codespell: | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'push' || | ||
github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name != github.repository | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: install codespell | ||
run: pip3 install codespell==${CODESPELL_VERSION} | ||
|
||
- name: run codespell | ||
run: make codespell | ||
|
||
verify-generation: | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'push' || | ||
github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name != github.repository | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: genrate code | ||
run: go generate ./... | ||
|
||
- name: check for changes | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "new files were generated" | ||
git status --porcelain | ||
git diff | ||
exit 1 | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: testing | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
if: (github.event_name == 'push') || | ||
(github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name != github.repository) || | ||
(github.event_name == 'workflow_dispatch') | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
golang: ['1.23', 'stable'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.golang }} | ||
|
||
- name: run tests | ||
run: make test | ||
|
||
- name: run tests with race | ||
run: make testrace | ||
|
||
run-tests-with-coverage: | ||
if: (github.event_name == 'push') || | ||
(github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name != github.repository) || | ||
(github.event_name == 'workflow_dispatch') | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.golang }} | ||
|
||
- name: run tests, collect code coverage data and send to Coveralls | ||
env: | ||
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make coverage coveralls-deps coveralls | ||
|
||
run-benchmarks: | ||
if: false | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.golang }} | ||
- name: run benchmarks | ||
run: make bench | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coverage.out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '2' | ||
|
||
run: | ||
timeout: 3m | ||
|
||
formatters: | ||
enable: | ||
- goimports | ||
|
||
linters: | ||
enable: | ||
- forbidigo | ||
- gocritic | ||
- lll | ||
- reassign | ||
- unconvert | ||
- gosec | ||
- errorlint | ||
- godot | ||
- revive | ||
- testpackage | ||
- unused | ||
|
||
settings: | ||
godot: | ||
scope: all | ||
lll: | ||
line-length: 120 | ||
tab-width: 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
GOTEST := go test | ||
TAGS := | ||
COVERAGE_FILE := coverage.out | ||
|
||
.PHONY: codespell | ||
codespell: | ||
@echo "Running codespell" | ||
@codespell | ||
|
||
.PHONY: test | ||
test: | ||
@echo "Running tests" | ||
@go test ./... -count=1 | ||
|
||
.PHONY: testrace | ||
testrace: | ||
@echo "Running tests with race flag" | ||
@go test ./... -count=100 -race | ||
|
||
.PHONY: coverage | ||
coverage: | ||
@echo "Running tests with coveralls" | ||
go test -tags "$(TAGS)" $(go list ./... | grep -v test_helpers) -v -p 1 -covermode=atomic -coverprofile=$(COVERAGE_FILE) -count=1 | ||
go tool cover -func=$(COVERAGE_FILE) | ||
|
||
.PHONY: coveralls | ||
coveralls: | ||
@echo "uploading coverage to coveralls" | ||
@goveralls -coverprofile=$(COVERAGE_FILE) -service=github | ||
|
||
.PHONY: coveralls-deps | ||
coveralls-deps: | ||
@echo "Installing coveralls" | ||
@go get github.com/mattn/goveralls | ||
@go install github.com/mattn/goveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Package option provides a type-safe way to represent optional values in Go. | ||
// An Optional[T] can either contain a value of type T (Some) or be empty (None). | ||
// | ||
// This is useful for: | ||
// - Clearly representing nullable fields in structs. | ||
// - Avoiding nil pointer dereferences. | ||
// - Providing explicit intent about optional values. | ||
package option |
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: I would not recommend using
codespell
as it finds almost no errors.My suggestion have a look at
tt
andtt-ee
wherecSpell
is used viapre-commit
.And in general, it would be very good if you could immediately run
hooks
checks when you commit new code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make it in separate PR