1+ # This workflow will build a golang project
2+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+ name : Go
5+
6+ on :
7+ push :
8+ branches : [ "master" ]
9+ pull_request :
10+ branches : [ "master" ]
11+
12+ jobs :
13+
14+ build :
15+ runs-on : ubuntu-latest
16+ strategy :
17+ fail-fast : false
18+ matrix :
19+ include :
20+ # Linux builds
21+ - goos : linux
22+ goarch : amd64
23+ name : linux-amd64
24+ - goos : linux
25+ goarch : arm64
26+ name : linux-arm64
27+ - goos : linux
28+ goarch : arm
29+ goarm : 7
30+ name : linux-armv7
31+ - goos : linux
32+ goarch : arm
33+ goarm : 6
34+ name : linux-armv6
35+ - goos : linux
36+ goarch : 386
37+ name : linux-386
38+ - goos : linux
39+ goarch : loong64
40+ name : linux-loong64
41+ - goos : linux
42+ goarch : mips
43+ name : linux-mips
44+ - goos : linux
45+ goarch : mips64
46+ name : linux-mips64
47+ - goos : linux
48+ goarch : mips64le
49+ name : linux-mips64le
50+ - goos : linux
51+ goarch : mipsle
52+ name : linux-mipsle
53+ - goos : linux
54+ goarch : ppc64
55+ name : linux-ppc64
56+ - goos : linux
57+ goarch : ppc64le
58+ name : linux-ppc64le
59+ - goos : linux
60+ goarch : riscv64
61+ name : linux-riscv64
62+ - goos : linux
63+ goarch : s390x
64+ name : linux-s390x
65+
66+ # Windows builds
67+ - goos : windows
68+ goarch : amd64
69+ name : windows-amd64
70+ ext : .exe
71+ - goos : windows
72+ goarch : arm64
73+ name : windows-arm64
74+ ext : .exe
75+ - goos : windows
76+ goarch : 386
77+ name : windows-386
78+ ext : .exe
79+
80+ # macOS builds
81+ - goos : darwin
82+ goarch : amd64
83+ name : darwin-amd64
84+ - goos : darwin
85+ goarch : arm64
86+ name : darwin-arm64
87+
88+ # FreeBSD builds
89+ - goos : freebsd
90+ goarch : amd64
91+ name : freebsd-amd64
92+ - goos : freebsd
93+ goarch : arm64
94+ name : freebsd-arm64
95+ - goos : freebsd
96+ goarch : 386
97+ name : freebsd-386
98+ - goos : freebsd
99+ goarch : arm
100+ name : freebsd-arm
101+ - goos : freebsd
102+ goarch : riscv64
103+ name : freebsd-riscv64
104+
105+ - goos : aix
106+ goarch : ppc64
107+ name : aix-ppc64
108+ - goos : dragonfly
109+ goarch : amd64
110+ name : dragonfly-amd64
111+ - goos : illumos
112+ goarch : amd64
113+ name : illumos-amd64
114+ - goos : netbsd
115+ goarch : 386
116+ name : netbsd-386
117+ - goos : netbsd
118+ goarch : amd64
119+ name : netbsd-amd64
120+ - goos : netbsd
121+ goarch : arm
122+ name : netbsd-arm
123+ - goos : netbsd
124+ goarch : arm64
125+ name : netbsd-arm64
126+ - goos : openbsd
127+ goarch : 386
128+ name : openbsd-386
129+ - goos : openbsd
130+ goarch : amd64
131+ name : openbsd-amd64
132+ - goos : openbsd
133+ goarch : arm
134+ name : openbsd-arm
135+ - goos : openbsd
136+ goarch : arm64
137+ name : openbsd-arm64
138+ - goos : openbsd
139+ goarch : ppc64
140+ name : openbsd-ppc64
141+ - goos : openbsd
142+ goarch : riscv64
143+ name : openbsd-riscv64
144+ - goos : plan9
145+ goarch : 386
146+ name : plan9-386
147+ - goos : plan9
148+ goarch : amd64
149+ name : plan9-amd64
150+ - goos : plan9
151+ goarch : arm
152+ name : plan9-arm
153+ - goos : solaris
154+ goarch : amd64
155+ name : solaris-amd64
156+
157+ steps :
158+ - uses : actions/checkout@v4
159+
160+ - name : Set up Go
161+ uses : actions/setup-go@v4
162+ with :
163+ go-version : ' 1.23.1'
164+
165+ - name : Build Gateway
166+ run : go build -ldflags="-s -w" -o gateway-${{ matrix.name }}${{ matrix.ext }} ./cmd/gateway
167+ env :
168+ GOOS : ${{ matrix.goos }}
169+ GOARCH : ${{ matrix.goarch }}
170+ GOARM : ${{ matrix.goarm }}
171+
172+ - name : Build KCP
173+ run : go build -ldflags="-s -w" -o kcp-${{ matrix.name }}${{ matrix.ext }} ./cmd/kcp
174+ env :
175+ GOOS : ${{ matrix.goos }}
176+ GOARCH : ${{ matrix.goarch }}
177+ GOARM : ${{ matrix.goarm }}
178+
179+ - name : Build QUIC
180+ run : go build -ldflags="-s -w" -o quic-${{ matrix.name }}${{ matrix.ext }} ./cmd/quic
181+ env :
182+ GOOS : ${{ matrix.goos }}
183+ GOARCH : ${{ matrix.goarch }}
184+ GOARM : ${{ matrix.goarm }}
185+
186+ - name : Upload artifacts artifacts
187+ uses : actions/upload-artifact@v4
188+ with :
189+ name : binaries-${{ matrix.name }}
190+ path : |
191+ gateway-${{ matrix.name }}${{ matrix.ext }}
192+ kcp-${{ matrix.name }}${{ matrix.ext }}
193+ quic-${{ matrix.name }}${{ matrix.ext }}
194+
195+ # 合并所有构建产物
196+ merge-artifacts :
197+ needs : build
198+ runs-on : ubuntu-latest
199+ steps :
200+ - name : Download all artifacts
201+ uses : actions/download-artifact@v4
202+ with :
203+ path : ./artifacts
204+ merge-multiple : true # 合并所有 artifacts
205+
206+ - name : Display structure
207+ run : ls -la ./artifacts
208+
209+ - name : Upload merged artifacts
210+ uses : actions/upload-artifact@v4
211+ with :
212+ name : mc-gateway-all-platforms
213+ path : ./artifacts/*
214+ retention-days : 30
0 commit comments