Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate ci jobs + add linter config (#5)
* separate ci jobs + add linter config
- Loading branch information
Showing
4 changed files
with
99 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
name: Build | ||
on: | ||
workflow_run: | ||
workflows: [Quality check] | ||
types: [completed] | ||
|
||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
- name: Build | ||
run: go mod download; go build -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,47 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
name: Check & Build | ||
name: Quality check | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
qa: | ||
name: Quality check | ||
lint: | ||
name: Linter | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Linter | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.53.2 | ||
|
||
- name: Tests | ||
run: go mod download; go test -cover -coverprofile=./unit-cover.txt -race ./... | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
with: | ||
files: ./unit-cover.txt | ||
flags: unittests | ||
name: codecov-umbrella | ||
fail_ci_if_error: true | ||
verbose: true | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
- name: Build | ||
run: go mod download; go build -v ./... | ||
tests: | ||
name: Tests | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
- name: Run tests | ||
run: go mod download; go test -cover -coverprofile=./unit-cover.txt -race ./... | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
with: | ||
files: ./unit-cover.txt | ||
flags: unittests | ||
name: codecov-umbrella | ||
fail_ci_if_error: true | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
run: | ||
deadline: 5m | ||
issues-exit-code: 1 | ||
skip-dirs: | ||
- docs | ||
- mocks | ||
- scripts | ||
|
||
output: | ||
format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
linters-settings: | ||
dupl: | ||
threshold: 250 | ||
lll: | ||
line-length: 160 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
errcheck: | ||
exclude-functions: | ||
- (io.Closer).Close | ||
cyclop: | ||
max-complexity: 10 | ||
funlen: | ||
lines: 50 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- dupl | ||
- errcheck | ||
- goconst | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- typecheck | ||
- unused | ||
- funlen | ||
- cyclop | ||
- lll | ||
- forbidigo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters