|
@@ -8,6 +8,7 @@ on:
|
|
|
branches:
|
|
|
- main
|
|
|
paths:
|
|
|
+ - '.github/workflows/release.yml'
|
|
|
- '**.js'
|
|
|
- '**.css'
|
|
|
- '**.html'
|
|
@@ -42,51 +43,34 @@ jobs:
|
|
|
go-version-file: go.mod
|
|
|
check-latest: true
|
|
|
|
|
|
- - name: Build 3x-ui
|
|
|
+ - name: Build 3X-UI
|
|
|
run: |
|
|
|
export CGO_ENABLED=1
|
|
|
export GOOS=linux
|
|
|
export GOARCH=${{ matrix.platform }}
|
|
|
- TOOLCHAIN_URL=""
|
|
|
- MUSL_CC_HOST="https://download.wireguard.com/qemu-test/toolchains/20240917/"
|
|
|
+ # Use Bootlin prebuilt cross-toolchains (musl 1.2.5 in stable series)
|
|
|
case "${{ matrix.platform }}" in
|
|
|
- amd64)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz"
|
|
|
- ;;
|
|
|
- arm64)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/aarch64-linux-musl-cross.tgz"
|
|
|
- ;;
|
|
|
- armv7)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/armv7l-linux-musleabihf-cross.tgz"
|
|
|
- export GOARCH=arm
|
|
|
- export GOARM=7
|
|
|
- ;;
|
|
|
- armv6)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/armv6-linux-musleabihf-cross.tgz"
|
|
|
- export GOARCH=arm
|
|
|
- export GOARM=6
|
|
|
- ;;
|
|
|
- armv5)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/arm-linux-musleabi-cross.tgz"
|
|
|
- export GOARCH=arm
|
|
|
- export GOARM=5
|
|
|
- ;;
|
|
|
- 386)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/i686-linux-musl-cross.tgz"
|
|
|
- ;;
|
|
|
- s390x)
|
|
|
- TOOLCHAIN_URL="$MUSL_CC_HOST/s390x-linux-musl-cross.tgz"
|
|
|
- ;;
|
|
|
+ amd64) BOOTLIN_ARCH="x86-64" ;;
|
|
|
+ arm64) BOOTLIN_ARCH="aarch64" ;;
|
|
|
+ armv7) BOOTLIN_ARCH="armv7-eabihf"; export GOARCH=arm GOARM=7 ;;
|
|
|
+ armv6) BOOTLIN_ARCH="armv6-eabihf"; export GOARCH=arm GOARM=6 ;;
|
|
|
+ armv5) BOOTLIN_ARCH="armv5-eabi"; export GOARCH=arm GOARM=5 ;;
|
|
|
+ 386) BOOTLIN_ARCH="x86-i686" ;;
|
|
|
+ s390x) BOOTLIN_ARCH="s390x-z13" ;;
|
|
|
esac
|
|
|
- echo "Downloading musl toolchain for ${{ matrix.platform }}"
|
|
|
- curl -LO "$TOOLCHAIN_URL"
|
|
|
- tar -xf *.tgz
|
|
|
- TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "*-cross" | head -n1)
|
|
|
- TOOLCHAIN_DIR=$(realpath "$TOOLCHAIN_DIR")
|
|
|
- export PATH="$TOOLCHAIN_DIR/bin:$PATH"
|
|
|
- # Detect compiler
|
|
|
- export CC=$(find $TOOLCHAIN_DIR/bin -name '*-gcc' | head -n1)
|
|
|
- echo "Using CC=$CC"
|
|
|
+ echo "Resolving Bootlin musl toolchain for arch=$BOOTLIN_ARCH (platform=${{ matrix.platform }})"
|
|
|
+ TARBALL_BASE="https://toolchains.bootlin.com/downloads/releases/toolchains/$BOOTLIN_ARCH/tarballs/"
|
|
|
+ TARBALL_URL=$(curl -fsSL "$TARBALL_BASE" | grep -oE "${BOOTLIN_ARCH}--musl--stable-[^\"]+\\.tar\\.xz" | sort -r | head -n1)
|
|
|
+ [ -z "$TARBALL_URL" ] && { echo "Failed to locate Bootlin musl toolchain for arch=$BOOTLIN_ARCH" >&2; exit 1; }
|
|
|
+ echo "Downloading: $TARBALL_URL"
|
|
|
+ cd /tmp
|
|
|
+ curl -fL -sS -o "$(basename "$TARBALL_URL")" "$TARBALL_BASE/$TARBALL_URL"
|
|
|
+ tar -xf "$(basename "$TARBALL_URL")"
|
|
|
+ TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "${BOOTLIN_ARCH}--musl--stable-*" | head -n1)
|
|
|
+ export PATH="$(realpath "$TOOLCHAIN_DIR")/bin:$PATH"
|
|
|
+ export CC=$(realpath "$(find "$TOOLCHAIN_DIR/bin" -name '*-gcc.br_real' -type f -executable | head -n1)")
|
|
|
+ [ -z "$CC" ] && { echo "No gcc.br_real found in $TOOLCHAIN_DIR/bin" >&2; exit 1; }
|
|
|
+ cd -
|
|
|
go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go
|
|
|
file xui-release
|
|
|
ldd xui-release || echo "Static binary confirmed"
|