diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db8fdd6..aa41d01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,30 +16,57 @@ jobs: os: ubuntu-latest - target: aarch64-unknown-linux-gnu os: ubuntu-latest + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + - target: aarch64-unknown-linux-musl + os: ubuntu-latest - target: x86_64-apple-darwin os: macos-latest - target: aarch64-apple-darwin os: macos-latest runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: - fetch-depth: 0 # needed for git-describe version + fetch-depth: 0 # needed for git-describe version - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - - name: Install cross-compilation tools + - name: Install cross-compilation tools (aarch64-gnu) if: matrix.target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV + - name: Install musl tools (x86_64-musl) + if: matrix.target == 'x86_64-unknown-linux-musl' + run: | + sudo apt-get update + sudo apt-get install -y musl-tools + + - name: Install cross (aarch64-musl) + if: matrix.target == 'aarch64-unknown-linux-musl' + uses: taiki-e/install-action@v2 + with: + tool: cross@0.2.5 + - name: Build + if: matrix.target != 'aarch64-unknown-linux-musl' run: cargo build --release --target ${{ matrix.target }} -p loon-cli + - name: Build (cross) + if: matrix.target == 'aarch64-unknown-linux-musl' + run: cross build --release --target ${{ matrix.target }} -p loon-cli + + - name: Verify static linking + if: contains(matrix.target, 'musl') + run: | + file target/${{ matrix.target }}/release/loon + ldd target/${{ matrix.target }}/release/loon || true + - name: Package run: | TAG=${GITHUB_REF#refs/tags/} @@ -48,7 +75,7 @@ jobs: tar czf "$ARCHIVE" loon echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: ${{ matrix.target }} path: ${{ env.ARCHIVE }} @@ -57,7 +84,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v7 with: merge-multiple: true