forked from SagerNet/sing-box
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
291 additions
and
358 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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/checkout@v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v4.1.0 | ||
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/checkout@v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v4.1.0 | ||
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/checkout@v4.1.1 | ||
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/upload-artifact@v4.1.0 | ||
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/checkout@v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v4.1.0 | ||
with: | ||
go-version: ${{needs.go.outputs.version}} | ||
|
||
- name: checkout sing repository | ||
uses: actions/checkout@v4.1.1 | ||
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/upload-artifact@v4.1.0 | ||
with: | ||
name: sing-box-${{env.VERSION}}-${{env.GOOS}}-${{matrix.jobs.output}} | ||
path: | | ||
sing-box | ||
sing-box.exe | ||
compression-level: 9 |
Oops, something went wrong.