Skip to content

Commit 8e6deb2

Browse files
committed
Added CI
1 parent e68c5b2 commit 8e6deb2

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [master]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
GO_VERSION: "1.25.8"
16+
17+
jobs:
18+
# ── 1. Lint ────────────────────────────────────────────────────────────────
19+
lint:
20+
name: Lint
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ env.GO_VERSION }}
28+
cache: true
29+
30+
- name: go vet
31+
run: go vet ./...
32+
33+
- name: gofmt
34+
run: |
35+
fmt=$(gofmt -l .)
36+
if [ -n "$fmt" ]; then
37+
echo "Files need formatting:"
38+
echo "$fmt"
39+
exit 1
40+
fi
41+
42+
# ── 2. Test matrix ────────────────────────────────────────────────────────
43+
test:
44+
name: Test (Go ${{ matrix.go }})
45+
runs-on: ubuntu-latest
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
go: ["1.25.8"]
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- uses: actions/setup-go@v5
55+
with:
56+
go-version: ${{ matrix.go }}
57+
cache: true
58+
59+
- name: Download modules
60+
run: go mod download
61+
62+
- name: Build
63+
run: go build ./...
64+
65+
- name: Test with race detector
66+
run: go test -race -count=1 -timeout=120s ./...
67+
68+
- name: Test with coverage
69+
if: matrix.go == env.GO_VERSION
70+
run: go test -coverprofile=coverage.out -covermode=atomic ./...
71+
72+
- name: Upload coverage
73+
if: matrix.go == env.GO_VERSION
74+
uses: codecov/codecov-action@v4
75+
with:
76+
file: coverage.out
77+
fail_ci_if_error: false
78+
79+
# ── 3. Benchmarks (informational only) ───────────────────────────────────
80+
bench:
81+
name: Benchmarks
82+
runs-on: ubuntu-latest
83+
needs: test
84+
steps:
85+
- uses: actions/checkout@v4
86+
- uses: actions/setup-go@v5
87+
with:
88+
go-version: ${{ env.GO_VERSION }}
89+
cache: true
90+
- name: Run benchmarks
91+
run: go test -bench=. -benchmem -run='^$' ./...

0 commit comments

Comments
 (0)