Skip to content

Commit

Permalink
CI: add linter jobs to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
UiP9AV6Y committed Feb 7, 2024
1 parent f35b8a2 commit dcf1ab9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 6 deletions.
44 changes: 38 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ name: Test

on:
push:
branches: [ $default-branch ]
branches: [ master ]
paths:
- '**/go.mod'
- '**/go.sum'
- '**/*.go'
pull_request:
branches: [ $default-branch ]
branches: [ master ]
paths:
- '**/go.mod'
- '**/go.sum'
- '**/*.go'

jobs:

test-library:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

Expand All @@ -26,13 +34,37 @@ jobs:
test-tools:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'tools/go.mod'

- name: Build
run: cd tools ; go build -v ./...

- name: Test
run: cd tools ; go test -v ./...

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Lint (Library)
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.0

- name: Lint (Tools)
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.0
working-directory: tools

17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

run:
timeout: 5m

linters:
disable-all: true
enable:
- gofmt
- govet
- ineffassign
- staticcheck
- typecheck
- unconvert
- unused
- whitespace

0 comments on commit dcf1ab9

Please sign in to comment.