Skip to content

Commit

Permalink
ci: introduce linting
Browse files Browse the repository at this point in the history
  • Loading branch information
pires committed Mar 15, 2023
1 parent b46edfe commit 1f05787
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: golangci-lint

on:
push:
tags:
- v*
branches:
- main
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.19', '1.20']
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3

- name: Format
run: go fmt

- name: Vet
run: go vet

- name: lint
uses: golangci/golangci-lint-action@v3
#with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
#version: v1.29

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
8 changes: 1 addition & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,16 @@ jobs:
matrix:
go: ['1.19', '1.20']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3

- name: Get dependencies
run: |
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
- name: Format
run: go fmt

- name: Vet
run: go vet

- name: Test
run: go test -race -v -covermode=atomic -coverprofile=coverage.out

Expand Down

0 comments on commit 1f05787

Please sign in to comment.