Skip to content

Commit

Permalink
multi builds
Browse files Browse the repository at this point in the history
  • Loading branch information
PuerNya committed Jul 20, 2024
1 parent 16a9b5c commit 08ea021
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 406 deletions.
28 changes: 0 additions & 28 deletions .github/renovate.json

This file was deleted.

5 changes: 0 additions & 5 deletions .github/update_dependencies.sh

This file was deleted.

169 changes: 169 additions & 0 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
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: amd64 }
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: 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:
# darwin
- { goos: darwin, goarch: arm64, output: arm64 }
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64 }
- { goos: darwin, goarch: amd64, goamd64: v3, output: amd64v3 }
# linux
- { goos: linux, goarch: 386, output: 386 }

- { goos: linux, goarch: s390x, output: s390x }
- { goos: linux, goarch: riscv64, output: riscv64 }

- { goos: linux, goarch: arm64, output: arm64 }

- { goos: linux, goarch: loong64, abi: '1', output: loong64-abi1 }
- { goos: linux, goarch: loong64, abi: '2', output: loong64-abi2 }

- { goos: linux, goarch: arm, goarm: 5, output: armv5 }
- { goos: linux, goarch: arm, goarm: 6, output: armv6 }
- { goos: linux, goarch: arm, goarm: 7, output: armv7 }

- { goos: linux, goarch: amd64, goamd64: v1, output: amd64 }
- { goos: linux, goarch: amd64, goamd64: v3, output: amd64v3 }

- { goos: linux, goarch: mips, output: mips }
- { goos: linux, goarch: mips, gomips: softfloat, output: mips-softfloat }
- { goos: linux, goarch: mips, gomips: hardfloat, output: mips-hardfloat }
- { goos: linux, goarch: mipsle, output: mipsle }

- { goos: linux, goarch: mips64, output: mips64 }
- { goos: linux, goarch: mips64, gomips: softfloat, output: mips64-softfloat }
- { goos: linux, goarch: mips64, gomips: hardfloat, output: mips64-hardfloat }
- { goos: linux, goarch: mips64le, output: mips64le }
# windows
- { goos: windows, goarch: 386, output: 386 }

- { goos: windows, goarch: arm64, output: arm64 }

- { goos: windows, goarch: arm, goarm: 7, output: arm32v7 }

- { goos: windows, goarch: amd64, goamd64: v1, output: amd64 }
- { goos: windows, goarch: amd64, goamd64: v3, output: amd64v3 }
# freebsd
- { goos: freebsd, goarch: arm64, output: arm64 }

- { goos: freebsd, goarch: amd64, goamd64: v1, output: amd64 }
- { goos: freebsd, goarch: amd64, goamd64: v3, output: amd64v3 }
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: 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}}
GOMIPS: ${{matrix.jobs.gomips}}
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
Loading

0 comments on commit 08ea021

Please sign in to comment.