Skip to content

Commit

Permalink
Merge pull request #68 from hermitkim1/release-cb-network-0.0.2
Browse files Browse the repository at this point in the history
Release cb-network-0.0.2
  • Loading branch information
hermitkim1 authored Jan 28, 2021
2 parents 2372977 + 2d25e8e commit eb8fb9c
Show file tree
Hide file tree
Showing 24 changed files with 1,765 additions and 675 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# The name of your workflow. GitHub displays the names of your workflows on your repository's actions page.
# If you omit name, GitHub sets it to the workflow file path relative to the root of the repository.
name: build-on-pull-request

# This workflow is triggered on pull request
on:
pull_request:
branches: [ $default-branch, develop ]
paths-ignore:
- '**.md'
- '.gitignore'
- 'LICENSE'

jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
# The job key is “build"
build:
# Job name is “Build”
name: Build

strategy:
matrix:
go-version: [ 1.15.x ]
os: [ ubuntu-18.04 ] #macos-latest, windows-latest
runs-on: ${{ matrix.os }}

steps:
# This action sets up a go environment for use in actions by:
# optionally downloading and caching a version of Go by version and adding to PATH
# registering problem matchers for error output
# This step uses GitHub's setup-go: https://github.com/actions/setup-go
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go

# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
# This step uses GitHub's checkout: https://github.com/actions/checkout
- name: Check out code into the Go module directory
uses: actions/checkout@v2

# This step installs dependencies
# - name: Get dependencies
# run: |
# go get -v -t -d ./...
# if [ -f Gopkg.toml ]; then
# curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
# dep ensure
# fi

# This step builds source codes
- name: Build
run: |
go build -v ./poc-cb-net/cmd/agent
go build -v ./poc-cb-net/cmd/server
34 changes: 16 additions & 18 deletions .github/workflows/lint-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
name: lint-on-push

# This workflow is triggered on push
on:
push:
branches:
- '**'
paths-ignore:
on:
push:
# Ignoring branches
Expand All @@ -16,6 +21,9 @@ on:
paths-ignore:
# Push events to poc-cb-net/archive/**
- 'poc-cb-net/archive/**'
- '**.md'
- '.gitignore'
- 'LICENSE'

jobs:
# Set the job key. The key is displayed as the job name
Expand All @@ -27,26 +35,16 @@ jobs:

strategy:
matrix:
go-version: [1.15.x]
os: [ubuntu-18.04] #macos-latest, windows-latest
go-version: [ 1.15.x ]
os: [ ubuntu-18.04 ] #macos-latest, windows-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
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

# Add args to skip dirs
args: --skip-dirs poc-cb-net/archive

# Optional: working directory, useful for monorepos
# working-directory: somedir
- name: Checkout source code
uses: actions/checkout@v2

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
- name: Install golangci-lint
run: go get github.com/golangci/golangci-lint/cmd/[email protected]

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
- name: Run golangci-lint
run: golangci-lint run
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
*.exe
poc-cb-net/cmd/agent/agent
poc-cb-net/cmd/server/server
poc-cb-net/cmd/server/server
poc-cb-net/configs/
150 changes: 150 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
linters-settings:
depguard:
list-type: blacklist
packages:
# An example
# - github.com/sirupsen/logrus
packages-with-error-message:
# An example
# - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
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.8
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
govet:
check-shadowing: true
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: 140
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
disable-all: true
enable:
# - bodyclose
# - deadcode
# - depguard
# - dogsled
# - dupl
# - errcheck
# - exhaustive
# - funlen
# - gochecknoinits
# - goconst
# - gocritic
- gocyclo
- gofmt
# - goimports
- golint
# - gomnd
# - goprintffuncname
# - gosec
# - gosimple
- govet
- ineffassign
# - interfacer
# - lll
- misspell
# - nakedret
# - noctx
# - nolintlint
# - rowserrcheck
# - scopelint
# - staticcheck
# - structcheck
# - stylecheck
# - typecheck
# - unconvert
# - unparam
# - unused
# - varcheck
# - whitespace
# don't enable:
# - asciicheck
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl
issues:
exclude-use-default: false
exclude:
- EXC0002
# 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:"
# TODO temporary rule, must be removed
# seems related to v0.34.1, but I was not able to reproduce locally,
# I was also not able to reproduce in the CI of a fork,
# only the golangci-lint CI seems to be affected by this invalid analysis.
- path: pkg/golinters/scopelint.go
text: 'directive `//nolint:interfacer` is unused for linter interfacer'
run:
skip-dirs:
- archive
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.35.x # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ module github.com/cloud-barista/cb-larva
go 1.15

require (
github.com/eclipse/paho.mqtt.golang v1.2.0 // indirect
github.com/labstack/echo v3.3.10+incompatible // indirect
github.com/cloud-barista/cb-log v0.3.0-espresso.0.20210124020413-4c2ac68dc7a0
github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/golangci/golangci-lint v1.35.2 // indirect
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0 // indirect
github.com/sirupsen/logrus v1.7.0
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/tools v0.1.0 // indirect
)
Loading

0 comments on commit eb8fb9c

Please sign in to comment.