Skip to content

Commit 9458573

Browse files
committed
build: add basic pipeline
1 parent 612b7cc commit 9458573

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'v*.*.*'
8+
pull_request:
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v5
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v6
21+
with:
22+
go-version: '1.25.x'
23+
check-latest: true
24+
25+
- name: Run golangci-lint
26+
uses: golangci/golangci-lint-action@v8
27+
with:
28+
version: latest
29+
args: --timeout=5m
30+
31+
test:
32+
name: Test
33+
runs-on: ubuntu-latest
34+
needs: lint
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v5
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v6
42+
with:
43+
go-version: '1.23.x'
44+
check-latest: true
45+
46+
- name: Cache Go modules
47+
uses: actions/cache@v4
48+
with:
49+
path: |
50+
~/go/pkg/mod
51+
~/.cache/go-build
52+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
53+
restore-keys: |
54+
${{ runner.os }}-go-
55+
56+
- name: Build
57+
run: go build ./...
58+
59+
- name: Test
60+
run: go test -v -race -cover ./...
61+
62+
release:
63+
name: Release
64+
needs: test
65+
runs-on: ubuntu-latest
66+
if: startsWith(github.ref, 'refs/tags/v')
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v5
71+
72+
- name: Create GitHub Release
73+
uses: softprops/action-gh-release@v2
74+
with:
75+
generate_release_notes: true
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)