From ef53f344ffe68f4246bf5591b5ced28a0c55bb10 Mon Sep 17 00:00:00 2001 From: lxien Date: Tue, 11 Aug 2026 14:39:36 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=8F=91=E5=B8=83=E5=8C=85=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0musl=E7=89=88=E6=9C=AC=EF=BC=8C=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E8=80=81=E7=9A=84=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 72 ++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14d8cfa..ffcc7ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,10 +48,22 @@ jobs: target: x86_64-unknown-linux-gnu goos: linux goarch: amd64 + libc: gnu + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + goos: linux + goarch: amd64 + libc: musl - os: ubuntu-24.04-arm target: aarch64-unknown-linux-gnu goos: linux goarch: arm64 + libc: gnu + - os: ubuntu-24.04-arm + target: aarch64-unknown-linux-musl + goos: linux + goarch: arm64 + libc: musl - os: windows-latest target: x86_64-pc-windows-msvc goos: windows @@ -84,6 +96,12 @@ jobs: npm ci npm run build + - name: Install musl toolchain + if: endsWith(matrix.target, '-musl') + run: | + sudo apt-get update + sudo apt-get install -y musl-tools + - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_VERSION }} @@ -95,6 +113,9 @@ jobs: - name: Build orbien-server + orbien shell: bash + env: + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc run: | cargo build --release --locked \ -p orbien-server -p orbien-client \ @@ -111,28 +132,44 @@ jobs: EXT="" if [[ "${{ matrix.goos }}" == "windows" ]]; then EXT=".exe"; fi BIN_DIR="target/${TARGET}/release" + LIBC="${{ matrix.libc }}" - ./scripts/pack-release.sh \ - --name orbien-server \ - --version "$VERSION" \ - --os "${{ matrix.goos }}" \ - --arch "${{ matrix.goarch }}" \ - --outdir "$OUT" \ - --bin "${BIN_DIR}/orbien-server${EXT}" \ - --config pack/conf/orbien-server.toml + pack_one() { + local name="$1" + local bin="$2" + local conf="$3" + if [[ -n "$LIBC" ]]; then + ./scripts/pack-release.sh \ + --name "$name" \ + --version "$VERSION" \ + --os "${{ matrix.goos }}" \ + --arch "${{ matrix.goarch }}" \ + --libc "$LIBC" \ + --outdir "$OUT" \ + --bin "$bin" \ + --config "$conf" + else + ./scripts/pack-release.sh \ + --name "$name" \ + --version "$VERSION" \ + --os "${{ matrix.goos }}" \ + --arch "${{ matrix.goarch }}" \ + --outdir "$OUT" \ + --bin "$bin" \ + --config "$conf" + fi + } - ./scripts/pack-release.sh \ - --name orbien \ - --version "$VERSION" \ - --os "${{ matrix.goos }}" \ - --arch "${{ matrix.goarch }}" \ - --outdir "$OUT" \ - --bin "${BIN_DIR}/orbien${EXT}" \ - --config pack/conf/orbien.toml + pack_one orbien-server \ + "${BIN_DIR}/orbien-server${EXT}" \ + pack/conf/orbien-server.toml + pack_one orbien \ + "${BIN_DIR}/orbien${EXT}" \ + pack/conf/orbien.toml - uses: actions/upload-artifact@v4 with: - name: cli-${{ matrix.goos }}-${{ matrix.goarch }} + name: cli-${{ matrix.target }} path: dist/release/*.tar.gz if-no-files-found: error @@ -563,3 +600,4 @@ jobs: artifacts/*.deb env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +