Skip to content

Commit

Permalink
refactor(config): polish
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Jun 20, 2020
1 parent cd7a9f7 commit 8836406
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 33 deletions.
Empty file added .github/linters/.eslintrc.yml
Empty file.
2 changes: 1 addition & 1 deletion .golangci.yml → .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
run:
# which dirs to skip: they won't be analyzed;
skip-dirs:
- service/account/proto
- mkit
skip-files:
- lib/bad.go

Expand Down
Empty file.
49 changes: 49 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore:
- 'master'

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: docker://github/super-linter:v2.1.0
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: develop
16 changes: 2 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
pull_request:
types: [assigned]
jobs:
lint-test:
name: Lint and Test
test:
name: Test
runs-on: ubuntu-latest
if: |
contains(github.event.commits[0].message, '[skip ci]') == false &&
Expand All @@ -15,12 +15,6 @@ jobs:
with:
go-version: 1.14
id: go
- name: Setup Tools
env:
GO111MODULE: off
run: |
go get github.com/golangci/golangci-lint/cmd/golangci-lint
GO111MODULE=on go get github.com/bufbuild/buf/cmd/buf
- name: Check out Code
uses: actions/checkout@v1
- name: Cache go modules
Expand All @@ -34,12 +28,6 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: go mod download
- name: Lint
run: |
make lint
# export PATH=$PATH:$(go env GOPATH)/bin
# golangci-lint run
# buf check lint
- name: Unit Test
run: make test-unit
- name: Integration Test
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
# - "v*.*.*"
paths-ignore: ["*.md", "docs", "deploy", "config", ".github", "scripts"]
jobs:
lint-test:
name: Lint and Test
test:
name: Test
runs-on: ubuntu-latest
if: |
contains(github.event.commits[0].message, '[skip ci]') == false &&
Expand All @@ -17,12 +17,6 @@ jobs:
with:
go-version: 1.14
id: go
- name: Setup Tools
env:
GO111MODULE: off
run: |
go get github.com/golangci/golangci-lint/cmd/golangci-lint
GO111MODULE=on go get github.com/bufbuild/buf/cmd/buf
- name: Check out Code
uses: actions/checkout@v1
- name: Cache go modules
Expand All @@ -36,12 +30,6 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: go mod download
- name: Lint
run: |
make lint
# export PATH=$PATH:$(go env GOPATH)/bin
# golangci-lint run
# buf check lint
- name: Unit Test
run: make test-unit
- name: Coverage Test
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
"--fast",
"--config=.github/linters/.golangci.yml"
],
// Proto
"clang-format.style": "google",
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ gomod_lint:
lint lint-%:
@if [ -z $(TARGET) ]; then \
echo "Linting all go"; \
${GOPATH}/bin/golangci-lint run ./... --deadline=5m; \
${GOPATH}/bin/golangci-lint run ./... --deadline=5m --config=.github/linters/.golangci.yml; \
else \
echo "Linting go in ${TARGET}-${TYPE}..."; \
${GOPATH}/bin/golangci-lint run ./${TYPE}/${TARGET}/... ; \
${GOPATH}/bin/golangci-lint run ./${TYPE}/${TARGET}/... --config=.github/linters/.golangci.yml; \
fi

# @clang-format -i $(shell find . -type f -name '*.proto')
Expand Down
3 changes: 2 additions & 1 deletion config/base/service/account/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ spec:
# We want the servers to become available even if they're not ready
publishNotReadyAddresses: true
ports:
- name: grpc-port
- name: grpc-web
appProtocol: grpc-web
port: 8080
protocol: TCP
targetPort: grpc-port
1 change: 1 addition & 0 deletions config/base/service/emailer/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spec:
publishNotReadyAddresses: true
ports:
- name: grpc-port
appProtocol: grpc
port: 8080
protocol: TCP
targetPort: grpc-port
14 changes: 14 additions & 0 deletions config/base/service/greeter/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: service-headless
spec:
clusterIP: None
# We want the servers to become available even if they're not ready
publishNotReadyAddresses: true
ports:
- name: grpc-port
appProtocol: grpc
port: 8080
protocol: TCP
targetPort: grpc-port
1 change: 1 addition & 0 deletions config/base/service/greeter/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spec:
publishNotReadyAddresses: true
ports:
- name: grpc-port
appProtocol: grpc
port: 8080
protocol: TCP
targetPort: grpc-port
1 change: 1 addition & 0 deletions config/base/service/recorder/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spec:
publishNotReadyAddresses: true
ports:
- name: grpc-port
appProtocol: grpc
port: 8080
protocol: TCP
targetPort: grpc-port
10 changes: 10 additions & 0 deletions docs/introduction/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ GO111MODULE=off go get github.com/golangci/golangci-lint/cmd/golangci-lint
# linter and tool for proto files
# (if you use brew to install buf, skip next line)
GO111MODULE=on go get github.com/bufbuild/buf/cmd/buf
# prototool make it eazy to use protoc plugins
GO111MODULE=on go get github.com/uber/prototool/cmd/prototool@dev
# kind - kubernetes in docker (optional)
GO111MODULE=on go get sigs.k8s.io/kind
# go lang build/publish/deploy tool (optional)
Expand All @@ -61,8 +63,16 @@ go install github.com/markbates/pkger/cmd/pkger

# fetch protoc plugins into $GOPATH
GO111MODULE=off go get github.com/golang/protobuf/{proto,protoc-gen-go}
# (or) get latest
go install github.com/golang/protobuf/protoc-gen-go

GO111MODULE=on go get github.com/micro/micro/v2/cmd/protoc-gen-micro@master

GO111MODULE=on go get github.com/gogo/protobuf/protoc-gen-gofast
GO111MODULE=on go get github.com/gogo/protobuf/protoc-gen-gogofast
GO111MODULE=on go get github.com/gogo/protobuf/protoc-gen-gogofaster
GO111MODULE=on go get github.com/gogo/protobuf/protoc-gen-gogoslick

# GO111MODULE=off go get -u github.com/envoyproxy/protoc-gen-validate
# GO111MODULE=off go get -u github.com/infobloxopen/protoc-gen-gorm
# getting official micro cli
Expand Down

0 comments on commit 8836406

Please sign in to comment.