From 7f537a420f8e25e144fc3fb4fdc2a54e75acd380 Mon Sep 17 00:00:00 2001 From: Wang Defa Date: Mon, 15 Dec 2025 14:54:57 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0=20CI=20=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=A7=BB=E9=99=A4=20Alpine=20=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主要改动: - 移除 Alpine 构建,只保留 Ubuntu 构建 - 简化构建矩阵(移除 distro 维度) - 添加静态链接验证步骤 - 更新 Release 说明,突出纯静态链接特性 - 优化构建输出和日志信息 - 更新 artifact 命名(移除 distro 后缀) --- .gitea/workflows/ci.yaml | 41 +++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 12d2b6c..f86513b 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -18,7 +18,6 @@ jobs: strategy: matrix: arch: [amd64, arm64] - distro: [ubuntu, alpine] steps: - uses: actions/checkout@v4 @@ -38,8 +37,9 @@ jobs: PLATFORM="linux/${{ matrix.arch }}" echo "🏗️ Building ${PLATFORM} on native ${{ matrix.arch }} runner" - echo "📦 Distribution: ${{ matrix.distro }}" + echo "📦 Using Ubuntu 20.04 with depends system" echo "📦 Monero Version: ${MONERO_VERSION}" + echo "🔗 Static linking enabled" # 设置 BuildKit 优化参数 export BUILDKIT_PROGRESS=plain @@ -48,19 +48,35 @@ jobs: --platform ${PLATFORM} \ --build-arg MONERO_VERSION=${MONERO_VERSION} \ --output type=local,dest=./output \ - -f docker/Dockerfile.${{ matrix.distro }} . + -f docker/Dockerfile.ubuntu . + + - name: Verify static linking + run: | + DIR="./output/linux_${{ matrix.arch }}" + BINARY="${DIR}/mond" + + if [ ! -f "$BINARY" ]; then + echo "❌ 二进制文件不存在: $BINARY" + exit 1 + fi + + echo "🔍 验证静态链接..." + if ldd "$BINARY" 2>&1 | grep -q "not a dynamic executable"; then + echo "✅ 纯静态链接验证成功" + else + echo "❌ 静态链接验证失败,发现动态库依赖:" + ldd "$BINARY" || true + exit 1 + fi + + file "$BINARY" - name: Package and test run: | DIR="./output/linux_${{ matrix.arch }}" - - if [ ! -d "$DIR" ]; then - echo "❌ 构建输出目录不存在: $DIR" - exit 1 - fi - VERSION=${MONERO_VERSION#v} # 移除前导 v - TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-${{ matrix.distro }}-${VERSION}.tar.gz" + TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-ubuntu-${VERSION}.tar.gz" + tar -czf "${TARGZ}" -C "$DIR" . echo "📦 Created package: ${TARGZ}" @@ -72,7 +88,6 @@ jobs: rm -rf test - name: Build Debian package - if: matrix.distro == 'ubuntu' run: | # 安装 dpkg-deb(如果需要) sudo apt-get update && sudo apt-get install -y dpkg-dev @@ -88,7 +103,7 @@ jobs: - uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4 with: - name: binaries-${{ matrix.arch }}-${{ matrix.distro }} + name: binaries-${{ matrix.arch }} path: | *.tar.gz *.deb @@ -168,7 +183,7 @@ jobs: echo "📝 生成 Release..." export REGISTRY OWNER TAG - RELEASE_DATA=$(python3 -c 'import json,glob,os;r=os.environ["REGISTRY"];o=os.environ["OWNER"];p=os.environ["PRODUCT_NAME"];t=os.environ["TAG"];b=["## Release "+t,"","Mond is a customized build of Monero daemon (monerod).","","### 📥 Download Methods","","#### Method 1: Direct Download (Recommended)","","Click on the file names in the **Assets** section below to download directly.","","#### Method 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### Method 3: Debian Repository","","**Debian 12 (bookworm):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian bookworm main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install mond","```","","**Debian 13 (trixie):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian trixie main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install mond","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))') + RELEASE_DATA=$(python3 -c 'import json,glob,os;r=os.environ["REGISTRY"];o=os.environ["OWNER"];p=os.environ["PRODUCT_NAME"];t=os.environ["TAG"];b=["## Release "+t,"","Mond is a customized build of Monero daemon (monerod).","","### ✨ Key Features","","- 🔗 **Pure Static Linking** - No dependencies required, runs on any Linux system","- 🏗️ **Multi-Architecture** - Native support for AMD64 and ARM64","- 📦 **Built with Official depends System** - Using Monero official build system for reliability","","### 📥 Download Methods","","#### Method 1: Direct Download (Recommended)","","Click on the file names in the **Assets** section below to download directly.","","**Available Packages:**",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### Method 2: Generic Package Registry","","Download via command line:",""]+[f"```bash\nwget https://{r}/api/packages/{o}/generic/{p}/{t}/{f}\n```" for f in sorted(glob.glob("*.tar.gz"))[:1]]+["","#### Method 3: Debian Repository","","**Debian 12 (Bookworm):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian bookworm main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install mond","```","","**Debian 13 (Trixie):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian trixie main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install mond","```","","### 🔍 Verify Static Linking","","After downloading, verify the binary is statically linked:","","```bash","ldd mond","# Expected output: \"not a dynamic executable\"","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))') # 创建 Release echo ""