From 4c14c71499806aec3fdc7a3ab02483d265630e05 Mon Sep 17 00:00:00 2001 From: Jordan Brockopp Date: Thu, 19 Dec 2019 08:12:42 -0600 Subject: [PATCH] ci: add explicit configuration for automation (#31) * ci: ignore tags for test/validate actions * ci: add default codecov configuration * ci: add golangci configuration * revert: ignore tags for test/validate actions --- .github/workflows/test.yml | 5 +-- .github/workflows/validate.yml | 1 + .golangci.yml | 73 ++++++++++++++++++++++++++++++++++ codecov.yml | 50 +++++++++++++++++++++++ 4 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 .golangci.yml create mode 100644 codecov.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0e8fc5c..e9f783a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,7 @@ name: test # trigger on pull_request or push events +# ignore push events with tag on: pull_request: push: @@ -16,10 +17,6 @@ jobs: - name: clone uses: actions/checkout@v1 - - name: install - run: | - go get github.com/mattn/goveralls - - name: test run: | go test -race -covermode=atomic -coverprofile=coverage.out ./... diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 867909fc..90465c17 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -2,6 +2,7 @@ name: validate # trigger on pull_request or push events +# ignore push events with tag on: pull_request: push: diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..16011810 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,73 @@ +# This is a manually created golangci.com yaml configuration with +# some defaults explicitly provided. There is a large number of +# linters we've enabled that are usually disabled by default. +# +# https://github.com/golangci/golangci-lint#config-file + +# This section provides the configuration for how golangci +# outputs it results from the linters it executes. +output: + format: colored-line-number + print-issued-lines: true + print-linter-name: true + +# This section provides the configuration for which linters +# golangci will execute. Several of them were disabled by +# default but we've opted to enable them. +linters: + # disable all linters as new linters might be added to golangci + disable-all: true + enable: + # linters enabled by default + - deadcode + - errcheck + - govet + - gosimple # a.k.a. megacheck + - ineffassign + - staticcheck + - structcheck + - typecheck + - unused + - varcheck + + # linters disabled by default + - bodyclose + - gocognit + - goconst + - gocyclo + - goimports + - gosec + - funlen + - maligned + - misspell + - stylecheck + - unparam + - whitespace + - wsl + + # static list of linters we know golangci can run but we've + # chosen to leave disabled for now + # + # disable: + # - depguard + # - dogsled + # - dupl + # - gocritic + # - gochecknoinits + # - gochecknoglobals + # - godox + # - gofmt + # - golint + # - gomnd + # - interfacer + # - lll + # - nakedret + # - scopelint + # - unconvert + +# This section provides the configuration for each linter +# we've instructed golangci to execute. Currently, we've +# left this part empty as we're going to roll with the +# linter specific default settings for now. +# +# linters-settings: diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..f23cd41a --- /dev/null +++ b/codecov.yml @@ -0,0 +1,50 @@ +# The is the default codecov.io yaml configuration all projects use +# that do not have their own codecov.yml already in the project. +# +# https://docs.codecov.io/docs/codecov-yaml#section-default-yaml + +# This section provides the generic configuration for codecov. +# +# https://docs.codecov.io/docs/codecovyml-reference#section-codecov +codecov: + + require_ci_to_pass: yes + +# This section provides the configuration for the +# coverage report codecov analyzes for results. +# +# https://docs.codecov.io/docs/codecovyml-reference#section-coverage +coverage: + + precision: 2 + round: down + range: "70...100" + + status: + project: yes + patch: yes + changes: no + +# This section provides the configuration for the +# parsers codecov uses for the coverage report. +# +# https://docs.codecov.io/docs/codecovyml-reference#section-parsers +parsers: + + gcov: + + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +# This section provides the configuration for the +# comments codecov makes to open pull requests. +# +# https://docs.codecov.io/docs/codecovyml-reference#section-comment +comment: + + layout: "reach, diff, flags, files" + behavior: default + require_changes: no