-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (84 loc) · 2.43 KB
/
ci.yml
File metadata and controls
98 lines (84 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Go SDK CI
on:
push:
branches:
- "**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
name: Test and Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
cache-dependency-path: go.sum
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Format check
run: |
gofmt -s -l . | tee /tmp/gofmt.out
test ! -s /tmp/gofmt.out
- name: Go vet
run: go vet ./...
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
continue-on-error: true
- name: Unit tests
run: go test ./... -v -race -coverprofile=coverage.out
- name: Test examples
run: |
echo "Testing examples build..."
cd examples/check-update && go build .
cd ../download-installer && go build .
cd ../report-errors && go build .
echo "✓ All examples build successfully"
- name: Cross-platform build test
env:
CGO_ENABLED: 0
run: |
echo "Testing cross-platform builds..."
# Test key platforms
GOOS=linux GOARCH=amd64 go build ./...
GOOS=linux GOARCH=arm64 go build ./...
GOOS=darwin GOARCH=amd64 go build ./...
GOOS=darwin GOARCH=arm64 go build ./...
GOOS=windows GOARCH=amd64 go build ./...
echo "✓ Cross-platform builds successful"
- name: Security scan
run: |
echo "Running security checks..."
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
echo "✓ Security scan completed"
continue-on-error: true
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
fail_ci_if_error: false