Skip to content

Commit 77c073c

Browse files
committed
Adds GitHub Actions workflows
1 parent 1572ce4 commit 77c073c

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
go-version: ['1.19', '1.20', '1.21']
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
cache: true
26+
27+
- name: Install dependencies
28+
run: go mod download
29+
30+
- name: Build
31+
run: go build -v ./...
32+
33+
- name: Run tests
34+
run: go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic
35+
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v4
38+
with:
39+
file: ./coverage.txt
40+
fail_ci_if_error: false
41+
env:
42+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43+
44+
lint:
45+
name: Lint
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Set up Go
51+
uses: actions/setup-go@v5
52+
with:
53+
go-version: '1.21'
54+
cache: true
55+
56+
- name: golangci-lint
57+
uses: golangci/golangci-lint-action@v4
58+
with:
59+
version: latest
60+
args: --timeout=5m

.golangci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
linters:
2+
enable:
3+
- gofmt
4+
- govet
5+
- goimports
6+
- gosimple
7+
- staticcheck
8+
- errcheck
9+
- ineffassign
10+
- typecheck
11+
- misspell
12+
- gosec
13+
- unconvert
14+
- goconst
15+
- unparam
16+
17+
linters-settings:
18+
govet:
19+
enable-all: true
20+
gocyclo:
21+
min-complexity: 15
22+
goconst:
23+
min-len: 2
24+
min-occurrences: 2
25+
misspell:
26+
locale: US
27+
28+
issues:
29+
exclude-rules:
30+
- path: _test\.go
31+
linters:
32+
- gosec
33+
- errcheck
34+
max-issues-per-linter: 0
35+
max-same-issues: 0
36+
37+
run:
38+
timeout: 5m

0 commit comments

Comments
 (0)