-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tmc/add-linting-coverage
github: Add linting coverage
- Loading branch information
Showing
6 changed files
with
144 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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,51 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
# Cache is managed by golangci-lint | ||
# https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs | ||
cache: false | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
args: --timeout=4m | ||
version: v1.57.1 | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: go build -v ./... | ||
test: | ||
runs-on: ubuntu-latest | ||
environment: ci | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
- uses: actions/checkout@v3 | ||
- name: Run tests with coverage | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4-beta | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains 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 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,49 @@ | ||
linters: | ||
presets: | ||
- bugs | ||
- comment | ||
- complexity | ||
- error | ||
- format | ||
- import | ||
- metalinter | ||
- module | ||
- performance | ||
- sql | ||
- style | ||
- test | ||
- unused | ||
disable: | ||
- godox # We allow TODO lines. | ||
- tagliatelle # As we're dealing with third parties we must accept snake case. | ||
- wsl # We don't agree with wsl's style rules | ||
- exhaustruct | ||
- lll | ||
- varnamelen | ||
- nlreturn | ||
- gomnd | ||
- goerr113 | ||
- wrapcheck # TODO: we should probably enable this one (at least for new code). | ||
- testpackage | ||
- nolintlint # see https://github.com/golangci/golangci-lint/issues/3228. | ||
- depguard # disabling temporarily | ||
- ireturn # disabling temporarily | ||
|
||
linters-settings: | ||
cyclop: | ||
max-complexity: 12 | ||
funlen: | ||
lines: 120 | ||
depguard: | ||
list-type: denylist | ||
packages: | ||
- github.com/samber/lo # Use exp packages or internal utilities instead. | ||
additional-guards: | ||
- list-type: denylist | ||
include-go-root: false | ||
packages: | ||
- github.com/stretchr/testify | ||
# Specify rules by which the linter ignores certain files for consideration. | ||
ignore-file-rules: | ||
- "**/*_test.go" | ||
- "**/mock/**/*.go" |
This file contains 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,31 @@ | ||
# This file contains convenience targets for the project. | ||
# It is not intended to be used as a build system. | ||
# See the README for more information. | ||
|
||
.PHONY: test | ||
test: | ||
go test ./... | ||
|
||
.PHONY: lint | ||
lint: lint-deps | ||
golangci-lint run --color=always --sort-results ./... | ||
|
||
.PHONY: lint-fix | ||
lint-fix: | ||
golangci-lint run --fix --skip-dirs=./exp ./... | ||
|
||
.PHONY: test-race | ||
test-race: | ||
go run test -race ./... | ||
|
||
.PHONY: test-cover | ||
test-cover: | ||
go run test -cover ./... | ||
|
||
.PHONY: lint-deps | ||
lint-deps: | ||
@command -v golangci-lint >/dev/null 2>&1 || { \ | ||
echo >&2 "golangci-lint not found. Installing..."; \ | ||
go install github.com/golangci/golangci-lint/cmd/[email protected]; \ | ||
} | ||
|
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/tmc/langgraphgo | ||
|
||
go 1.21.5 | ||
go 1.22 | ||
|
||
require github.com/tmc/langchaingo v0.1.7 | ||
|
||
|
This file contains 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