diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5304b0420..7f341b844 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,6 @@ on: push: tags: - 'v*.*.*' - pull_request: - branches: - - develop permissions: contents: write @@ -45,14 +42,83 @@ jobs: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --target task_executable - - name: Build task binary (Linux — native) + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update -q + sudo apt-get install -y cmake clang libclang-dev uuid-dev + + - name: Isolate UUID headers + if: runner.os == 'Linux' + run: | + sudo mkdir -p /opt/musl-includes/uuid + sudo cp /usr/include/uuid/uuid.h /opt/musl-includes/uuid/ + + - name: Set up Rust musl target + if: runner.os == 'Linux' + run: rustup target add x86_64-unknown-linux-musl + + - name: Set up Zig + if: runner.os == 'Linux' + uses: mlugg/setup-zig@v1 + with: + version: "0.14.0" + + - name: Create musl-cc/musl-cxx wrappers + if: runner.os == 'Linux' + run: | + sudo tee /usr/local/bin/musl-cc > /dev/null << 'WRAPPER' + #!/bin/bash + args=() + skip_next=0 + for arg in "$@"; do + [ "$skip_next" = "1" ] && { skip_next=0; continue; } + [ "$arg" = "-target" ] && { skip_next=1; continue; } + [[ "$arg" == --target=* ]] && continue + args+=("$arg") + done + exec zig cc -target x86_64-linux-musl "${args[@]}" + WRAPPER + sudo tee /usr/local/bin/musl-cxx > /dev/null << 'WRAPPER' + #!/bin/bash + args=() + skip_next=0 + for arg in "$@"; do + [ "$skip_next" = "1" ] && { skip_next=0; continue; } + [ "$arg" = "-target" ] && { skip_next=1; continue; } + [[ "$arg" == --target=* ]] && continue + args+=("$arg") + done + exec zig c++ -target x86_64-linux-musl "${args[@]}" + WRAPPER + sudo chmod +x /usr/local/bin/musl-cc /usr/local/bin/musl-cxx + + - name: Build task binary (Linux — musl) if: runner.os == 'Linux' run: | set -e - sudo apt-get update -qq - sudo apt-get install -y -qq libclang-dev - export LIBCLANG_PATH=$(dpkg -L libclang-dev 2>/dev/null | grep 'libclang.*\.so$' | head -1 | xargs dirname || echo /usr/lib/llvm-14/lib) - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + printf '%s\n' \ + 'set(CMAKE_SYSTEM_NAME Linux)' \ + 'set(CMAKE_SYSTEM_PROCESSOR x86_64)' \ + 'set(CMAKE_C_COMPILER /usr/local/bin/musl-cc)' \ + 'set(CMAKE_CXX_COMPILER /usr/local/bin/musl-cxx)' \ + 'set(CMAKE_C_COMPILER_WORKS TRUE)' \ + 'set(CMAKE_CXX_COMPILER_WORKS TRUE)' \ + 'set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "")' \ + 'set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "")' \ + 'set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)' \ + 'set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)' \ + 'set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)' \ + > /tmp/musl-toolchain.cmake + _lib=$(dpkg -L libclang-dev 2>/dev/null | grep 'libclang.*\.so$' | head -1) + export LIBCLANG_PATH=${_lib:+$(dirname "$_lib")} + export LIBCLANG_PATH=${LIBCLANG_PATH:-/usr/lib/llvm-14/lib} + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE=/tmp/musl-toolchain.cmake \ + -DUUID_INCLUDE_DIR=/opt/musl-includes \ + -DUUID_LIBRARY=/usr/lib/x86_64-linux-gnu/libuuid.so \ + -DRust_CARGO_TARGET=x86_64-unknown-linux-musl cmake --build build --target task_executable -j$(nproc) - name: Package binary + completions