-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from invidian/updates
Add CI and fix existing issues
- Loading branch information
Showing
12 changed files
with
323 additions
and
128 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,68 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: golangci/golangci-lint:v1.44.0 | ||
steps: | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Required for Codecov report uploading. | ||
fetch-depth: 0 | ||
- run: make install-cc-test-reporter install-changelog BIN_PATH=/usr/local/bin | ||
- run: make test-update-linters test-tidy test-changelog test-cover-upload lint | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/build-push-action@v2 | ||
codespell: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: codespell-project/actions-codespell@master | ||
with: | ||
skip: .git,go.sum | ||
ignore_words_list: decorder | ||
check_filenames: true | ||
check_hidden: true | ||
semgrep: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Use dedicated action for nice integration with GitHub. | ||
- uses: returntocorp/semgrep-action@v1 | ||
build-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Generate GPG key | ||
run: echo "GPG_FINGERPRINT=$(gpg --batch --passphrase '' --quick-gen-key USER_ID default default 2>&1 | grep 'marked as ultimately trusted' | cut -d' ' -f3)" >> $GITHUB_ENV | ||
- uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
args: release --snapshot |
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 +1,2 @@ | ||
terraform-provider-gpg* | ||
/c.out |
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,121 @@ | ||
outpur: | ||
sort-results: true | ||
|
||
issues: | ||
exclude-use-default: false | ||
max-same-issues: 0 | ||
max-issues-per-linter: 0 | ||
|
||
linters-settings: | ||
errcheck: | ||
check-type-assertions: true | ||
check-blank: true | ||
gci: | ||
local-prefixes: github.com/invidian/terraform-provider-gpg | ||
godot: | ||
capital: true | ||
gofumpt: | ||
extra-rules: true | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
- shadow | ||
makezero: | ||
always: true | ||
nolintlint: | ||
allow-leading-space: false | ||
require-explanation: true | ||
require-specific: true | ||
wsl: | ||
force-err-cuddling: true | ||
|
||
linters: | ||
disable: | ||
# Allow returning interface as a convention. | ||
- ireturn | ||
# Allow making use of zero-value of struct fields. | ||
- exhaustivestruct | ||
# Don't require API-compatible errors. | ||
- goerr113 | ||
# This linter has been deprecated. | ||
- golint | ||
- interfacer | ||
- maligned | ||
enable: | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- cyclop | ||
- deadcode | ||
- decorder | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- forbidigo | ||
- forcetypeassert | ||
- funlen | ||
- gci | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- godox | ||
- gofmt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
- gomnd | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- grouper | ||
- ifshort | ||
- importas | ||
- ineffassign | ||
- lll | ||
- maintidx | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- nlreturn | ||
- noctx | ||
- nolintlint | ||
- paralleltest | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- structcheck | ||
- stylecheck | ||
- tagliatelle | ||
- tenv | ||
- testpackage | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- varcheck | ||
- varnamelen | ||
- wastedassign | ||
- whitespace | ||
- wrapcheck | ||
- wsl |
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,25 @@ | ||
rules: | ||
- id: bad-error-wrap-wording | ||
patterns: | ||
- pattern-regex: fmt\.Errorf\(".?([Ff]ailed|[]Uu]nable|[Cc]ould|([Ee]rror)) | ||
message: Word "fail", "failed", "unable", "could not" should not be used when wrapping errors. Use verb in continuous form instead! | ||
languages: [go] | ||
severity: ERROR | ||
- id: printed-messages-must-be-captialized | ||
patterns: | ||
- pattern-regex: (fmt.Print(ln|f)|\bt\.(Error|Fatal|Log)(|f))\("[a-z] | ||
message: Printed messages must be capitalized. | ||
languages: [go] | ||
severity: ERROR | ||
- id: strings-must-be-quoted-using-q | ||
patterns: | ||
- pattern-regex: "'%s'" | ||
message: When formatting, strings must be quoted using %q instead of e.g. '%s'. | ||
languages: [go] | ||
severity: ERROR | ||
- id: error-wrapping-must-be-preceded-by-space | ||
patterns: | ||
- pattern-regex: '[^ ]%w' | ||
message: When wrapping errors, %w must be preceded by space. | ||
languages: [go] | ||
severity: ERROR |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.