forked from SagerNet/sing-box
-
Notifications
You must be signed in to change notification settings - Fork 81
153 lines (135 loc) · 5.07 KB
/
core.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Build Cores
on:
push:
jobs:
go:
runs-on: ubuntu-latest
outputs:
version: ${{steps.go.outputs.version}}
steps:
- name: get latest go version
id: go
run: |
echo version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
sing-box:
runs-on: ubuntu-latest
needs: go
outputs:
version: ${{steps.sing-box.outputs.version}}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: setup go
uses: actions/[email protected]
with:
go-version: ${{needs.go.outputs.version}}
- name: get sing-box version
id: sing-box
run: |
git remote add sekai https://github.com/SagerNet/sing-box.git
git fetch --tags sekai
version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
echo version=$version >> $GITHUB_OUTPUT
build-android:
runs-on: ubuntu-latest
needs:
- go
- sing-box
strategy:
matrix:
jobs:
- { goarch: '386', ndk: i686-linux-android34, output: '386' }
- { goarch: arm, ndk: armv7a-linux-androideabi34, output: armeabi-v7a }
- { goarch: arm64, ndk: aarch64-linux-android34, output: arm64-v8a }
- { goarch: amd64, ndk: x86_64-linux-android34, output: x86_64 }
env:
VERSION: ${{needs.sing-box.outputs.version}}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: setup go
uses: actions/[email protected]
with:
go-version: ${{needs.go.outputs.version}}
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26b
- name: checkout sing repository
uses: actions/[email protected]
with:
ref: fix-interface
path: sing
repository: PuerNya/sing
- name: replace sing
run: sed -i 's/^\/\/replace github.com.*$/replace github.com\/sagernet\/sing => .\/sing/' go.mod
- name: build core
env:
CC: ${{steps.setup-ndk.outputs.ndk-path}}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{matrix.jobs.ndk}}-clang
TAGS: with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_clash_api,with_gvisor
GOOS: android
GOARM: '7'
GOARCH: ${{matrix.jobs.goarch}}
CGO_ENABLED: '1'
run: go build -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" ./cmd/sing-box
- name: upload core
uses: actions/[email protected]
with:
name: sing-box-${{env.VERSION}}-android-${{matrix.jobs.output}}
path: sing-box
compression-level: 9
build-other-platform:
runs-on: ubuntu-latest
needs:
- go
- sing-box
strategy:
matrix:
jobs:
- { goos: darwin, goarch: arm64, goamd64: v1, output: arm64 }
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64 }
- { goos: linux, goarch: '386', goamd64: v1, output: '386' }
- { goos: linux, goarch: arm64, goamd64: v1, output: arm64 }
- { goos: linux, goarch: amd64, goamd64: v1, output: x86_64 }
- { goos: linux, goarch: amd64, goamd64: v3, output: x86_64_v3 }
- { goos: windows, goarch: '386', goamd64: v1, output: '386' }
- { goos: windows, goarch: arm64, goamd64: v1, output: arm64 }
- { goos: windows, goarch: amd64, goamd64: v1, output: x86_64 }
- { goos: windows, goarch: amd64, goamd64: v3, output: x86_64_v3 }
env:
GOOS: ${{matrix.jobs.goos}}
VERSION: ${{needs.sing-box.outputs.version}}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: setup go
uses: actions/[email protected]
with:
go-version: ${{needs.go.outputs.version}}
- name: checkout sing repository
uses: actions/[email protected]
with:
ref: fix-interface
path: sing
repository: PuerNya/sing
- name: replace sing
run: sed -i 's/^\/\/replace github.com.*$/replace github.com\/sagernet\/sing => .\/sing/' go.mod
- name: build core
env:
TAGS: with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_reality_server,with_clash_api,with_gvisor
GOARCH: ${{matrix.jobs.goarch}}
GOAMD64: ${{matrix.jobs.goamd64}}
CGO_ENABLED: '0'
run: go build -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" ./cmd/sing-box
- name: upload core
uses: actions/[email protected]
with:
name: sing-box-${{env.VERSION}}-${{env.GOOS}}-${{matrix.jobs.output}}
path: |
sing-box
sing-box.exe
compression-level: 9