Skip to content

Commit b663b02

Browse files
feat(ci): add golang test pipeline
1 parent b8f80ab commit b663b02

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/go-test.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Go Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "backend/**"
8+
- ".github/workflows/go-test.yml"
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: "1.23.4"
22+
cache-dependency-path: backend/go.sum
23+
24+
- name: Cache Go modules
25+
uses: actions/cache@v3
26+
with:
27+
path: |
28+
~/.cache/go-build
29+
~/go/pkg/mod
30+
key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-
33+
34+
- name: Download dependencies
35+
working-directory: ./backend
36+
run: go mod download
37+
38+
- name: Verify dependencies
39+
working-directory: ./backend
40+
run: go mod verify
41+
42+
- name: Run go vet
43+
working-directory: ./backend
44+
run: go vet ./...
45+
46+
- name: Run tests
47+
working-directory: ./backend
48+
run: go test -race -coverprofile=coverage.out ./...
49+
50+
- name: Upload coverage reports to Codecov
51+
uses: codecov/codecov-action@v5
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)