Skip to content

Commit a28f187

Browse files
committed
add Go CI workflow
1 parent c4dca5f commit a28f187

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Go CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v3
21+
with:
22+
go-version: '1.24'
23+
24+
- name: Cache Go modules
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cache/go-build
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Install dependencies
33+
run: |
34+
go mod tidy
35+
36+
- name: Build the project
37+
run: |
38+
go build -v ./...
39+
40+
- name: Run tests
41+
run: |
42+
go test -v ./...
43+
44+
- name: Run GolangCI-Lint
45+
run: |
46+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.6
47+
./golangci-lint run || true
48+
49+
- name: Run Staticcheck
50+
run: |
51+
go install honnef.co/go/tools/cmd/staticcheck@latest
52+
staticcheck ./... || true

0 commit comments

Comments
 (0)