From 2ff2456fcb8af8fe8aff36278014d6e42fe6a354 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 28 Sep 2024 14:01:54 +0800 Subject: [PATCH] feat(release): use cargo-zigbuild to build for glibc 2.17 (#660) --- .github/workflows/release.yaml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8d4f41f..22259f1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -56,8 +56,6 @@ jobs: os_name: linux arch: x86_64 rust_target: x86_64-unknown-linux-gnu - docker_platform: linux/amd64 - container: quay.io/pypa/manylinux2014_x86_64 # for glibc 2.17 - os: ubuntu-latest os_name: linux arch: aarch64 @@ -85,28 +83,27 @@ jobs: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 - if: ${{ matrix.config.container == null }} + - uses: dtolnay/rust-toolchain@master - if: ${{ matrix.config.container == null }} with: targets: ${{ matrix.config.rust_target }} toolchain: 1.80.0 + + - name: Install cargo-zigbuild + if: ${{ matrix.config.os_name == 'linux' }} + uses: baptiste0928/cargo-install@v3 + with: + crate: cargo-zigbuild + - name: Build all crates - if: ${{ matrix.config.container == null }} + if: ${{ matrix.config.os_name != 'linux' }} run: | cargo build --release --features ${{ matrix.feature }} - - name: Build all crates with glibc 2.17 # for glibc 2.17 - if: ${{ matrix.config.container != null }} + - name: Build all crates with glibc 2.17 + if: ${{ matrix.config.os_name == 'linux' }} run: | - # sudo apt-get install -y qemu qemu-user-static - docker run \ - --rm \ - -v $(pwd):/workspace \ - -w /workspace \ - --platform ${{ matrix.config.docker_platform }} \ - ${{ matrix.config.container }} \ - bash -c "yum install -y openssl-devel && curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && . /root/.cargo/env && cargo build --release --features ${{ matrix.feature }}" + cargo zigbuild --target ${{ matrix.config.rust_target }}.2.17 --release --features ${{ matrix.feature }} - name: Handle binaries if: ${{ matrix.config.os_name != 'windows' }}