Multi Builds #72
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
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 |