-
Notifications
You must be signed in to change notification settings - Fork 9
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
CI initial commit #2
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,77 @@ | ||
--- | ||
name: ci | ||
on: pull_request | ||
jobs: | ||
yamllint: | ||
name: yamllint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: yaml-lint | ||
uses: ibiqlik/action-yamllint@v1 | ||
with: | ||
config_file: .yamllint.yml | ||
strict: true | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: shellcheck | ||
uses: fkautz/shell-linter@v1.0.1 | ||
golangci-lint: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. golangci-lint job can be simplified https://github.com/networkservicemesh/cmd-template/blob/master/.github/workflows/ci.yaml#L42 |
||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.31 | ||
excludeFmtErrorf: | ||
name: exclude fmt.Errorf | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Exclude fmt.Errorf | ||
run: | | ||
if grep -r --include=*.go --exclude=*.pb.go fmt.Errorf . ; then | ||
echo "Please use errors.Errorf (or errors.New or errors.Wrap or errors.Wrapf) as appropriate rather than fmt.Errorf" | ||
exit 1 | ||
fi | ||
checkgomod: | ||
name: check go.mod and go.sum | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.15 | ||
- run: go mod tidy | ||
- name: Check for changes in go.mod or go.sum | ||
run: | | ||
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false ) | ||
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) | ||
gogenerate: | ||
name: Check generated files | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: arduino/setup-protoc@master | ||
with: | ||
version: '3.8.0' | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.15 | ||
- name: Install proto-gen-go | ||
run: go get -u github.com/golang/protobuf/protoc-gen-go@v1.3.3 | ||
- name: Install proto-gen-go | ||
run: go get github.com/searKing/golang/tools/cmd/go-syncmap | ||
- name: Generate files | ||
run: go generate ./... | ||
- name: Check for changes in generated code | ||
run: | | ||
git diff -- '*.pb.go' || ( echo "Rerun go generate ./... locally and resubmit" && false ) | ||
git diff -- '*.gen.go' || ( echo "Rerun go generate ./... locally and resubmit" && false ) |
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 @@ | ||
.idea |
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,171 @@ | ||
--- | ||
run: | ||
# concurrency: 6 | ||
timeout: 2m | ||
issues-exit-code: 1 | ||
tests: true | ||
linters-settings: | ||
goheader: | ||
template-path: "./.license/template.txt" | ||
values: | ||
const: | ||
year: 2020 | ||
regexp: | ||
year-range: ((\d\d\d\d-{{year}})|({{year}})) | ||
company: .* | ||
copyright-holder: Copyright \(c\) {{year-range}} {{company}}\n\n | ||
copyright-holders: ({{copyright-holder}})+ | ||
errcheck: | ||
check-type-assertions: false | ||
check-blank: false | ||
govet: | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/sirupsen/logrus.FieldLogger).Infof | ||
- (github.com/sirupsen/logrus.FieldLogger).Warnf | ||
- (github.com/sirupsen/logrus.FieldLogger).Errorf | ||
- (github.com/sirupsen/logrus.FieldLogger).Fatalf | ||
golint: | ||
min-confidence: 0.8 | ||
goimports: | ||
local-prefixes: github.com/networkservicemesh/integration-k8s-kind | ||
gocyclo: | ||
min-complexity: 15 | ||
maligned: | ||
suggest-new: true | ||
dupl: | ||
threshold: 150 | ||
funlen: | ||
Lines: 100 | ||
Statements: 50 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
depguard: | ||
list-type: blacklist | ||
include-go-root: false | ||
packages: | ||
- errors | ||
packages-with-error-message: | ||
# specify an error message to output when a blacklisted package is used | ||
- errors: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports" | ||
misspell: | ||
locale: US | ||
unparam: | ||
check-exported: false | ||
nakedret: | ||
max-func-lines: 30 | ||
prealloc: | ||
simple: true | ||
range-loops: true | ||
for-loops: false | ||
gocritic: | ||
enabled-checks: | ||
- appendAssign | ||
- assignOp | ||
- appendCombine | ||
- argOrder | ||
- badCall | ||
- badCond | ||
- boolExprSimplify | ||
- builtinShadow | ||
- captLocal | ||
- caseOrder | ||
- codegenComment | ||
- commentFormatting | ||
- commentedOutCode | ||
- commentedOutImport | ||
- defaultCaseOrder | ||
- deprecatedComment | ||
- docStub | ||
- dupArg | ||
- dupBranchBody | ||
- dupCase | ||
- dupImport | ||
- dupSubExpr | ||
- elseif | ||
- emptyFallthrough | ||
- emptyStringTest | ||
- equalFold | ||
- evalOrder | ||
- exitAfterDefer | ||
- flagDeref | ||
- flagName | ||
- hexLiteral | ||
- hugeParam | ||
- ifElseChain | ||
- importShadow | ||
- indexAlloc | ||
- initClause | ||
- methodExprCall | ||
- nestingReduce | ||
- newDeref | ||
- nilValReturn | ||
- octalLiteral | ||
- offBy1 | ||
- paramTypeCombine | ||
- rangeExprCopy | ||
- rangeValCopy | ||
- regexpMust | ||
- regexpPattern | ||
- singleCaseSwitch | ||
- sloppyLen | ||
- sloppyReassign | ||
- stringXbytes | ||
- switchTrue | ||
- typeAssertChain | ||
- typeSwitchVar | ||
- typeUnparen | ||
- unlabelStmt | ||
- unnamedResult | ||
- unnecessaryBlock | ||
- underef | ||
- unlambda | ||
- unslice | ||
- valSwap | ||
- weakCond | ||
- wrapperFunc | ||
- yodaStyleExpr | ||
linters: | ||
disable-all: true | ||
enable: | ||
# - rowserrcheck | ||
- goheader | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- funlen | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- golint | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- interfacer | ||
# - lll | ||
- misspell | ||
- nakedret | ||
- scopelint | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
# - unused | ||
- varcheck | ||
- whitespace | ||
issues: | ||
exclude-use-default: false | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
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,48 @@ | ||
## Copyright headers for source code | ||
This folder contains the copyright templates for source files of NSM project. | ||
|
||
Below is an example of valid copyright header for `.go` files: | ||
``` | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Cisco and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// 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. | ||
``` | ||
Note you can use your company name instead of `Cisco and/or its affiliates`. | ||
Also, source code files can have multi copyright holders, for example: | ||
``` | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Cisco and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Red Hat Inc. and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 VMware, Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// 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. | ||
``` |
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,13 @@ | ||
{{copyright-holders}}SPDX-License-Identifier: Apache-2.0 | ||
|
||
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. |
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,16 @@ | ||
--- | ||
extends: default | ||
|
||
yaml-files: | ||
- '*.yaml' | ||
- '*.yml' | ||
|
||
rules: | ||
truthy: disable | ||
# 80 chars should be enough, but don't fail if a line is longer | ||
line-length: disable | ||
indentation: disable | ||
comments-indentation: | ||
ignore: .circleci/config.yml | ||
|
||
ignore: scripts/aws/aws-k8s-cni.yaml |
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,43 @@ | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// 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. | ||
|
||
package integration_k8s_kind_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type BasicTestsSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *BasicTestsSuite) SetupSuite() { | ||
|
||
} | ||
|
||
func (s *BasicTestsSuite) TearDownSuite() { | ||
|
||
} | ||
|
||
func (s *BasicTestsSuite) TearDownTest() { | ||
|
||
} | ||
|
||
func TestRunBasicSuite(t *testing.T) { | ||
suite.Run(t, &BasicTestsSuite{}) | ||
} |
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,5 @@ | ||
module github.com/networkservicemesh/integration-k8s-packet | ||
|
||
go 1.15 | ||
|
||
require github.com/stretchr/testify v1.6.1 |
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,11 @@ | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= | ||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
Oops, something went wrong.
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.
yamllint job can be simplified https://github.com/networkservicemesh/cmd-template/blob/master/.github/workflows/ci.yaml#L9