Skip to content

Commit 4179af2

Browse files
committed
Add initial github action: ci.yml
1 parent 06b440d commit 4179af2

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
7+
branches: ['**']
8+
9+
jobs:
10+
golangci-lint:
11+
name: golangci-lint
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v5
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v6
20+
with:
21+
go-version: '1.23'
22+
cache: false # golangci-lint-action handles its own caching
23+
24+
- name: Run golangci-lint
25+
uses: golangci/golangci-lint-action@v9
26+
with:
27+
version: latest
28+
go-version: '1.23'
29+
30+
- name: Check for formatting issues
31+
run: |
32+
if [ -n "$(gofmt -l .)" ]; then
33+
echo "Go code is not formatted:"
34+
gofmt -d .
35+
exit 1
36+
fi
37+
38+
go-vet:
39+
name: go vet
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v5
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v6
48+
with:
49+
go-version: '1.23'
50+
cache: true
51+
52+
- name: Run go vet
53+
run: go vet ./...
54+
55+
staticcheck:
56+
name: staticcheck
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v5
62+
63+
- name: Set up Go
64+
uses: actions/setup-go@v6
65+
with:
66+
go-version: '1.23'
67+
cache: true
68+
69+
- name: Install staticcheck
70+
run: go install honnef.co/go/tools/cmd/staticcheck@latest
71+
72+
- name: Run staticcheck
73+
run: staticcheck ./...
74+
75+
test:
76+
name: Test
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v5
82+
83+
- name: Set up Go
84+
uses: actions/setup-go@v6
85+
with:
86+
go-version: '1.23'
87+
cache: true
88+
89+
- name: Install Java (for JVM tests)
90+
uses: actions/setup-java@v5
91+
with:
92+
distribution: 'temurin'
93+
java-version: '11'
94+
95+
- name: Verify Go installation
96+
run: |
97+
go version
98+
go env
99+
100+
- name: Download dependencies
101+
run: go mod download
102+
103+
- name: Verify dependencies
104+
run: go mod verify
105+
106+
- name: Run tests
107+
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
108+

0 commit comments

Comments
 (0)