Skip to content

Commit

Permalink
multi builds
Browse files Browse the repository at this point in the history
  • Loading branch information
PuerNya committed Aug 13, 2024
1 parent a1ac290 commit e598314
Show file tree
Hide file tree
Showing 9 changed files with 291 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.

153 changes: 153 additions & 0 deletions .github/workflows/core.yml
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@v5.0.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:
runs-on: ubuntu-latest
needs:
- go
- sing-box
strategy:
matrix:
jobs:
# android
- { goos: android, goarch: 386, goarm: 7, ndk: i686-linux-android34, output: 386 }
- { goos: android, goarch: arm, goarm: 7, ndk: armv7a-linux-androideabi34, output: armeabi-v7a }
- { goos: android, goarch: arm64, goarm: 7, ndk: aarch64-linux-android34, output: arm64-v8a }
- { goos: android, goarch: amd64, goarm: 7, ndk: x86_64-linux-android34, output: amd64 }

# 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:
ABI: ${{ matrix.jobs.abi }}
GOOS: ${{ matrix.jobs.goos }}
GOARM: ${{ matrix.jobs.goarm }}
GOARCH: ${{ matrix.jobs.goarch }}
GOAMD64: ${{ matrix.jobs.goamd64 }}
GOMIPS: ${{ matrix.jobs.gomips }}
CGO_ENABLED: ${{ matrix.jobs.goos == 'android' && 1 || 0 }}
VERSION: ${{ needs.sing-box.outputs.version }}
SUFFIX: ${{ matrix.jobs.goos == 'windows' && '.exe' || '' }}
steps:
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0

- name: setup go
uses: actions/setup-go@v5.0.0
with:
go-version: ${{ needs.go.outputs.version }}

- name: Setup NDK
if: ${{ matrix.jobs.goos == 'android' }}
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26c

- name: Setup CC ENV
if: ${{ matrix.jobs.goos == 'android' }}
run: echo "CC=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.jobs.ndk }}-clang" >> $GITHUB_ENV

- name: build both-side core
env:
TAGS: with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_acme,with_reality_server,with_clash_api,with_gvisor
run: go build -o sing-box-both-side${{ env.SUFFIX }} -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" ./cmd/sing-box

- name: build client core
env:
TAGS: with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_clash_api,with_gvisor
run: go build -o sing-box-client${{ env.SUFFIX }} -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" ./cmd/sing-box

- name: build server core
env:
TAGS: with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_acme,with_reality_server,with_gvisor
run: go build -o sing-box-server${{ env.SUFFIX }} -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-client${{ env.SUFFIX }}
sing-box-server${{ env.SUFFIX }}
sing-box-both-side${{ env.SUFFIX }}
compression-level: 9
Loading

0 comments on commit e598314

Please sign in to comment.