generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: GitHub <[email protected]>
- Loading branch information
Showing
7 changed files
with
103 additions
and
254 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 |
---|---|---|
@@ -1,38 +1,59 @@ | ||
name: Default Meshery Adapter Library Workflow | ||
name: Default Meshery Adapter Library CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- 'v*' | ||
- 'master' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
- uses: actions/checkout@vmaster | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.19' | ||
check-latest: true | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||
version: v1.52 | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
args: --exclude=G306 | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
# only-new-issues: true | ||
version: latest | ||
- name: Run golangci-lint | ||
run: make lint | ||
tidy: | ||
name: tidy | ||
needs: [ golangci ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@vmaster | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.19' | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: tidy | ||
run: make tidy | ||
codecov: | ||
name: codecov | ||
needs: [ tidy ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@vmaster | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.19' | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: test | ||
run: make test | ||
- name: Upload covergae to Codecov | ||
if: github.repository == 'meshery/meshery-adapter-library' | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.out | ||
flags: unittests |
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
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,144 +1,64 @@ | ||
linters-settings: | ||
depguard: | ||
list-type: blacklist | ||
packages: | ||
# logging is allowed only by logutils.Log, logrus | ||
# is allowed to use only in logutils package | ||
- github.com/sirupsen/logrus | ||
packages-with-error-message: | ||
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" | ||
dupl: | ||
threshold: 100 | ||
exhaustive: | ||
default-signifies-exhaustive: false | ||
funlen: | ||
lines: 100 | ||
statements: 50 | ||
go-mod-tidy: | ||
enabled: true | ||
gci: | ||
local-prefixes: github.com/golangci/golangci-lint | ||
enabled: true | ||
max-len: 120 | ||
line-length: 120 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
enabled: true | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
- wrapperFunc | ||
gocyclo: | ||
min-complexity: 15 | ||
goimports: | ||
local-prefixes: github.com/golangci/golangci-lint | ||
golint: | ||
min-confidence: 0 | ||
gomnd: | ||
settings: | ||
mnd: | ||
# don't include the "operation" and "assign" | ||
checks: argument,case,condition,return | ||
gosec: | ||
settings: | ||
exclude: -G204 | ||
enabled: true | ||
disable: | ||
- parallelize | ||
- nesting | ||
- hugeParam | ||
- hugeStruct | ||
- nestParam | ||
- prealloc | ||
govet: | ||
check-shadowing: false | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
lll: | ||
line-length: 950 | ||
maligned: | ||
suggest-new: true | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
enabled: true | ||
check-shadowing: true | ||
tests: true | ||
golint: | ||
enabled: true | ||
min-confidence: 0.8 | ||
unused: | ||
enabled: true | ||
check-exported: true | ||
check-packages: true | ||
check-generated: true | ||
tests: true | ||
allow-unused-type-export: true | ||
cyclop: | ||
enabled: true | ||
average-strictness: 7 | ||
scopelint: | ||
enabled: true | ||
tests: true | ||
|
||
|
||
# Configuration for golangci-lint that is suitable for a Kubernetes operator project built with Golang | ||
linters: | ||
# please, do not use `enable-all`: it's deprecated and will be removed soon. | ||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint | ||
# https://golangci-lint.run/usage/linters/ | ||
disable-all: true | ||
enable: | ||
# TODO: consider continuously if more should be enabled. | ||
# Can also be useful to run with more strict settings before commit locally, i.e. to test for TODOs (godox) | ||
# - bodyclose | ||
# - deadcode | ||
- dogsled | ||
# - dupl | ||
- errcheck | ||
# - exhaustive | ||
# - funlen | ||
# - goconst | ||
# - gocritic | ||
# - gocyclo | ||
- gofmt | ||
- goimports | ||
# - golint | ||
- gomodguard | ||
- gosec | ||
# - gomnd | ||
# - goprintffuncname | ||
- gosimple | ||
enable-all: false | ||
disable-all: false | ||
linters: | ||
- gci | ||
- goconst | ||
- gocritic | ||
- govet | ||
- ineffassign | ||
# - interfacer | ||
- lll | ||
- misspell | ||
# - nakedret | ||
# - nolintlint | ||
# - rowserrcheck | ||
# - scopelint | ||
- staticcheck | ||
# - structcheck | ||
- stylecheck | ||
- typecheck | ||
# - unconvert | ||
# - unparam | ||
- golint | ||
- unused | ||
# - varcheck | ||
- whitespace | ||
- asciicheck | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godot | ||
# - godox | ||
# - goerr113 | ||
# - maligned | ||
# - nestif | ||
# - prealloc | ||
# - testpackage | ||
# - wsl | ||
|
||
issues: | ||
# Excluding configuration per-path, per-linter, per-text and per-source | ||
- cyclop | ||
- scopelint | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gomnd | ||
|
||
# https://github.com/go-critic/go-critic/issues/926 | ||
- linters: | ||
- gocritic | ||
text: "unnecessaryDefer:" | ||
- testpackage | ||
|
||
run: | ||
skip-dirs: | ||
- test/testdata_etc | ||
- internal/cache | ||
- internal/renameio | ||
- internal/robustio | ||
timeout: 5m | ||
enable-cache: true | ||
skip-dirs: | ||
- vendor | ||
- bundle | ||
- hack | ||
- img |
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,41 +1,15 @@ | ||
# Copyright Meshery Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
.PHONY: lint tidy verify | ||
|
||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
ifeq (,$(shell go env GOBIN)) | ||
GOBIN=$(shell go env GOPATH)/bin | ||
else | ||
GOBIN=$(shell go env GOBIN) | ||
endif | ||
|
||
.PHONY: tidy check-lint check-clean-cache tidy verify error | ||
|
||
error: | ||
go run github.com/layer5io/meshkit/cmd/errorutil -d . analyze -i ./helpers -o ./helpers | ||
|
||
check-lint: | ||
$(GOBIN)/golangci-lint run ./... | ||
|
||
check-clean-cache: | ||
go clean | ||
$(GOBIN)/golangci-lint cache clean | ||
lint: | ||
golangci-lint run -c .golangci.yml -v ./... | ||
|
||
tidy: | ||
go mod tidy | ||
gofmt -w . | ||
$(GOBIN)/goimports -w . | ||
|
||
verify: | ||
go mod verify | ||
go vet ./... | ||
go vet ./... | ||
|
||
test: | ||
go test --short ./... -race -coverprofile=coverage.txt -covermode=atomic |
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
Oops, something went wrong.