Skip to content

Commit

Permalink
Update CI configuration and CODEOWNERS
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <[email protected]>
  • Loading branch information
Aisuko authored Oct 10, 2023
1 parent 6f52116 commit bfcfd1b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 228 deletions.
105 changes: 9 additions & 96 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: Default Meshery Linkerd Workflow
name: Meshery Linkerd Workflow

on:
# No one should be pushing to master directly.
push:
branches:
- '*'
tags:
- 'v*'
paths-ignore:
- 'docs/**'
- '.github/**'
- 'img/**'
- 'templates/**'
- master
pull_request:
branches:
- master
Expand All @@ -27,7 +21,7 @@ jobs:
go_changes: ${{ steps.filter.outputs.go_changes }}
yaml_changes: ${{ steps.filter.outputs.yaml_changes }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@master
- uses: dorny/paths-filter@v2
id: filter
with:
Expand All @@ -37,35 +31,22 @@ jobs:
yaml_changes:
- '**.yml'
- '**.yaml'
golangci-lint:
runs-on: ubuntu-latest
needs: detect_changes
if: needs.detect_changes.outputs.go_changes == 'true'
steps:

- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '^1.19'

- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-
go-version: 1.19
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

uses: actions/checkout@master
- name: Run Linters
uses: golangci/golangci-lint-action@v3
with:
args: --timeout 3m --verbose
version: latest
args: --timeout=5m
codecov:
name: Code Coverage
if: github.repository == 'meshery/meshery-linkerd'
Expand All @@ -85,71 +66,3 @@ jobs:
with:
files: ./coverage.txt
flags: unittests
error_code_check:
name: Error code utility check
runs-on: ubuntu-22.04
needs: detect_changes
if: needs.detect_changes.outputs.yaml_changes == 'true'
steps:

- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '^1.19'

- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- run: |
errWillHave="level=error"
GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/layer5io/meshkit/cmd/errorutil;
err=$(/home/runner/go/bin/errorutil -d . update --skip-dirs meshery -i ./helpers -o ./helpers);
echo "ERR: $err";
if [[ $err == *"$errWillHave"* ]];
then
echo "$err";
return 1;
fi
tests:
name: Tests
runs-on: ubuntu-22.04
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '^1.19'

- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create cluster using KinD
uses: engineerd/[email protected]
with:
version: "v0.11.0"
- run: |
export CURRENTCONTEXT="$(kubectl config current-context)"
echo "current-context:" ${CURRENTCONTEXT}
export KUBECONFIG="${HOME}/.kube/config"
echo "environment-kubeconfig:" ${KUBECONFIG}
GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go test -v ./...
181 changes: 50 additions & 131 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,144 +1,63 @@
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
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:
enable-cache: true
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio
timeout: 5m
- vendor
- bundle
- config
- hack
- helpers
- img
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @Revolyssup @leecalcote @aisuko
@adapter-maintainers

0 comments on commit bfcfd1b

Please sign in to comment.