-
-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (119 loc) · 3.86 KB
/
Copy pathci.yml
File metadata and controls
135 lines (119 loc) · 3.86 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.2"
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Staticcheck
run: go run honnef.co/go/tools/cmd/staticcheck@latest ./...
- name: Gosec
run: go run github.com/securego/gosec/v2/cmd/gosec@latest -conf=.gosec.json ./...
- name: Run tests
run: go test ./...
build:
name: Build on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: amd64
goos: linux
goarch: amd64
- os: ubuntu-latest
arch: arm64
goos: linux
goarch: arm64
- os: windows-latest
arch: amd64
goos: windows
goarch: amd64
- os: windows-latest
arch: arm64
goos: windows
goarch: arm64
- os: macos-latest
arch: amd64
goos: darwin
goarch: amd64
- os: macos-latest
arch: arm64
goos: darwin
goarch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.2"
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Build
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 go build -o fontget-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }} .
shell: bash
- name: Verify binary
run: |
# Only verify binaries that match the runner's architecture
# ARM64 binaries can't run on x86_64 runners, so we just verify they exist
if [ "${{ matrix.goarch }}" = "arm64" ]; then
# For ARM64, just verify the binary exists and has reasonable size
if [ "${{ matrix.goos }}" = "windows" ]; then
if [ -f "./fontget-${{ matrix.goos }}-${{ matrix.goarch }}.exe" ]; then
ls -lh ./fontget-${{ matrix.goos }}-${{ matrix.goarch }}.exe
echo "✓ ARM64 Windows binary created successfully"
else
echo "✗ ARM64 Windows binary not found"
exit 1
fi
else
if [ -f "./fontget-${{ matrix.goos }}-${{ matrix.goarch }}" ]; then
ls -lh ./fontget-${{ matrix.goos }}-${{ matrix.goarch }}
echo "✓ ARM64 ${{ matrix.goos }} binary created successfully"
else
echo "✗ ARM64 ${{ matrix.goos }} binary not found"
exit 1
fi
fi
else
# For amd64, we can actually run the binary to verify it works
if [ "${{ matrix.goos }}" = "windows" ]; then
./fontget-${{ matrix.goos }}-${{ matrix.goarch }}.exe version
else
./fontget-${{ matrix.goos }}-${{ matrix.goarch }} version
fi
fi
shell: bash