From 667536d019336edc94ebaec2a3070de89f58f0a1 Mon Sep 17 00:00:00 2001 From: James Brink Date: Sat, 8 Feb 2025 22:39:19 -0700 Subject: [PATCH] fix(ci): add OpenSSL configuration for cross-compilation - Add OpenSSL installation for musl targets - Configure OpenSSL build environment variables - Add platform-specific dependencies for Linux and macOS - Improve musl toolchain setup --- .github/workflows/test.yml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9aac80..ecd1016 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,13 +48,41 @@ jobs: components: clippy, rustfmt targets: ${{ matrix.target }} - - name: Install cross-compilation dependencies + - name: Install Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y qemu-user + sudo apt-get install -y qemu-user musl-tools pkg-config libssl-dev + + - name: Install macOS dependencies + if: runner.os == 'macOS' + run: | + brew install openssl@3 + + - name: Setup musl build environment + if: contains(matrix.target, 'musl') + run: | + # Install musl-gcc + sudo apt-get install -y musl-tools + # Install musl OpenSSL + wget https://www.openssl.org/source/openssl-3.1.4.tar.gz + tar xzf openssl-3.1.4.tar.gz + cd openssl-3.1.4 + # Configure and build OpenSSL for musl + CC="musl-gcc -fPIC" ./Configure no-shared no-async --prefix=/usr/local/musl --openssldir=/usr/local/musl linux-x86_64 + make -j$(nproc) + sudo make install + cd .. + # Set environment variables for OpenSSL + echo "OPENSSL_DIR=/usr/local/musl" >> $GITHUB_ENV + echo "OPENSSL_STATIC=1" >> $GITHUB_ENV + + - name: Setup cross-compilation for ARM + if: contains(matrix.target, 'aarch64') || contains(matrix.target, 'armv7') + run: | + sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf cargo install cross - + - name: Cache dependencies uses: actions/cache@v4 with: