Use golangci lint action (#549)

* Use action insted download binary file

* Update ci

* Add config option

* Use pre-built docker image for golangci-lint-action

* Remove pre build docker action

* Update action name

* Remove env

* Update ci file

* Add working directory

* Change GITHUB_WORKSPACE

* Update ci file

* Fix ci

* Comment golangci-lint-action

* Update working-directory

* Fix path

* Update ci-build.yml

* Update path

* Revert changes

* Update .golangci.yml

* Add new path for triggers ci

* Separate steps

* Add working-directory

* Add test pwd and ls

* Fix working directory

* Update script for linting in Dockerfile

* Move .golangci.yml to dir backend

* Delete unnecessary word

* Remove multiline string

* Reformat multiline strings to single

* Update disable-all option
This commit is contained in:
Stas
2020-01-13 10:56:56 -06:00
committed by Umputun
parent 3447afffdd
commit b2176a175d
4 changed files with 35 additions and 20 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: build docker image
run: docker build --build-arg SKIP_BACKEND_TEST=true --build-arg SKIP_FRONTEND_TEST=true --build-arg CI=github .
+11 -15
View File
@@ -8,18 +8,20 @@ on:
- '.github/workflows/ci-test-backend.yml'
- 'backend/**'
- '!backend/scripts/**'
- '.golangci.yml'
pull_request:
paths:
- '.github/workflows/ci-test-backend.yml'
- 'backend/**'
- '!backend/scripts/**'
- '.golangci.yml'
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: debug if needed
run: |
@@ -51,21 +53,15 @@ jobs:
go get -u github.com/mattn/goveralls
- name: run backend linters
run: |
cd backend
$GITHUB_WORKSPACE/golangci-lint run --out-format=tab --disable-all --tests=false --enable=unconvert \
--enable=megacheck --enable=structcheck --enable=gas --enable=gocyclo --enable=dupl --enable=misspell \
--enable=unparam --enable=varcheck --enable=deadcode --enable=typecheck \
--enable=ineffassign --enable=varcheck ./... ;
cd _example/memory_store
$GITHUB_WORKSPACE/golangci-lint run --out-format=tab --disable-all --tests=false --enable=unconvert \
--enable=megacheck --enable=structcheck --enable=gas --enable=gocyclo --enable=dupl --enable=misspell \
--enable=unparam --enable=varcheck --enable=deadcode --enable=typecheck \
--enable=ineffassign --enable=varcheck ./... ;
run: $GITHUB_WORKSPACE/golangci-lint run --config .golangci.yml ./...
working-directory: backend
- name: run linters for examples
run: $GITHUB_WORKSPACE/golangci-lint run --config ${GITHUB_WORKSPACE}/backend/.golangci.yml ./...
working-directory: backend/_example/memory_store
- name: submit coverage
run: |
cd backend
$(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
working-directory: backend
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 -4
View File
@@ -22,10 +22,7 @@ RUN \
if [ -z "$SKIP_BACKEND_TEST" ] ; then \
go test -p 1 -timeout="${BACKEND_TEST_TIMEOUT:-300s}" -covermode=count -coverprofile=/profile.cov_tmp ./... && \
cat /profile.cov_tmp | grep -v "_mock.go" > /profile.cov ; \
golangci-lint run --out-format=tab --disable-all --tests=false --enable=unconvert \
--enable=megacheck --enable=structcheck --enable=gas --enable=gocyclo --enable=dupl --enable=misspell \
--enable=unparam --enable=varcheck --enable=deadcode --enable=typecheck \
--enable=ineffassign --enable=varcheck ./... ; \
golangci-lint run --config .golangci.yml ./... ; \
else echo "skip backend tests and linter" ; fi
# if DRONE presented use DRONE_* git env to make version
+22
View File
@@ -0,0 +1,22 @@
run:
tests: false
output:
format: tab
skip-dirs:
- vendor
linters:
enable:
- unconvert
- megacheck
- structcheck
- gas
- gocyclo
- dupl
- misspell
- unparam
- varcheck
- deadcode
- typecheck
- ineffassign
- varcheck
disable-all: true