Skip to content

Commit

Permalink
Merge pull request #2 from mgfeller/feature/mgfeller/1
Browse files Browse the repository at this point in the history
Initial code commit
  • Loading branch information
leecalcote authored Oct 7, 2020
2 parents 4c01118 + 1a6ae1c commit cdeaac0
Show file tree
Hide file tree
Showing 21 changed files with 2,940 additions and 121 deletions.
125 changes: 4 additions & 121 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name:
name: Meshery Adapter Library

on:
push:
branches:
- 'master'
- '**'
tags:
- 'v*'
pull_request:
Expand All @@ -19,7 +20,7 @@ jobs:
uses: golangci/golangci-lint-action@v1
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.29
version: v1.31

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand All @@ -29,121 +30,3 @@ jobs:

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
server-tests:
needs: [tests-ui, golangci, build-backend, build-ui]
name: Server tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Setup Cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go test -tags draft ./...
build-backend:
name: Backend build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Setup Cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build -tags draft ./cmd/main.go
build-ui:
name: UI build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: ${{ secrets.NODE_VERSION }}
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: |
cd ui
npm i
npm run build && npm run export
cd ..
cd provider-ui
npm i
npm run build && npm run export
tests-ui:
name: UI tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: ${{ secrets.NODE_VERSION }}
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: |
cd ui
npm i
npm test
cd ..
cd provider-ui
npm i
npm test
cd ..
mesheryctl_build:
name: Mesheryctl build & release
runs-on: macos-latest
needs: [server-tests]
steps:
- name: Check out code
uses: actions/checkout@master
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Setup Cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: goreleaser WITHOUT tag
uses: goreleaser/goreleaser-action@v1
if: success() && startsWith(github.ref, 'refs/tags/') == false
with:
version: latest
args: release --snapshot --skip-publish --rm-dist
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
meshops.proto

# Created by https://www.toptal.com/developers/gitignore/api/go
# Edit at https://www.toptal.com/developers/gitignore?templates=go

### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
Expand All @@ -13,3 +19,9 @@

# Dependency directories (remove the comment below to include it)
# vendor/

### Go Patch ###
/vendor/
/Godeps/

# End of https://www.toptal.com/developers/gitignore/api/go
144 changes: 144 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
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
goconst:
min-len: 2
min-occurrences: 2
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
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

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
- govet
- ineffassign
# - interfacer
- lll
- misspell
# - nakedret
# - nolintlint
# - rowserrcheck
# - scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
# - unconvert
# - unparam
- 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
exclude-rules:
- path: _test\.go
linters:
- gomnd

# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"

run:
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio
timeout: 5m
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
check:
golangci-lint run

check-clean-cache:
golangci-lint cache clean

protoc-setup:
wget -P meshes https://raw.githubusercontent.com/layer5io/meshery/master/meshes/meshops.proto

proto:
protoc -I meshes/ meshes/meshops.proto --go_out=plugins=grpc:./meshes/
Loading

0 comments on commit cdeaac0

Please sign in to comment.