Skip to content

Commit c197056

Browse files
committed
feat: add GitHub Actions workflow for building and testing Go application
1 parent 2b5387d commit c197056

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
- 'feature/**'
9+
pull_request:
10+
branches:
11+
- main
12+
- develop
13+
14+
jobs:
15+
build:
16+
name: Build and Test
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.24'
27+
cache: true
28+
29+
- name: Install dependencies
30+
run: go mod download
31+
32+
- name: Verify dependencies
33+
run: go mod verify
34+
35+
- name: Run go vet
36+
run: go vet ./...
37+
38+
- name: Run tests
39+
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v4
43+
with:
44+
file: ./coverage.txt
45+
fail_ci_if_error: false
46+
47+
- name: Build for Linux amd64
48+
run: |
49+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/node-pulse/agent/cmd.Version=dev-${{ github.sha }}" -o dist/nodepulse-linux-amd64 .
50+
51+
- name: Build for Linux arm64
52+
run: |
53+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/node-pulse/agent/cmd.Version=dev-${{ github.sha }}" -o dist/nodepulse-linux-arm64 .

0 commit comments

Comments
 (0)