diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1942e300..f586c9cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,3 +42,24 @@ jobs: - name: Run tests run: swift test -v + + static-linux-sdk-build: + name: Linux Static SDK Build (${{ matrix.swift-version }} - ${{ matrix.os }}) + strategy: + matrix: + os: [ubuntu-latest] + swift-version: + - 6.1.2 + runs-on: ${{ matrix.os }} + container: swift:${{ matrix.swift-version }}-noble + timeout-minutes: 30 + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install static SDK and build + env: + BUILD_FLAGS: "" + run: | + which curl || (apt -q update && apt -yq install curl) + curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \ + bash -s -- --static --flags="$BUILD_FLAGS" ${{ matrix.swift-version }} diff --git a/Sources/MCP/Base/Transports/StdioTransport.swift b/Sources/MCP/Base/Transports/StdioTransport.swift index 195fc30c..84bfd93a 100644 --- a/Sources/MCP/Base/Transports/StdioTransport.swift +++ b/Sources/MCP/Base/Transports/StdioTransport.swift @@ -13,9 +13,11 @@ import struct Foundation.Data import Darwin.POSIX #elseif canImport(Glibc) import Glibc +#elseif canImport(Musl) + import Musl #endif -#if canImport(Darwin) || canImport(Glibc) +#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) /// An implementation of the MCP stdio transport protocol. /// /// This transport implements the [stdio transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#stdio) @@ -107,7 +109,7 @@ import struct Foundation.Data /// - Parameter fileDescriptor: The file descriptor to configure /// - Throws: Error if the operation fails private func setNonBlocking(fileDescriptor: FileDescriptor) throws { - #if canImport(Darwin) || canImport(Glibc) + #if canImport(Darwin) || canImport(Glibc) || canImport(Musl) // Get current flags let flags = fcntl(fileDescriptor.rawValue, F_GETFL) guard flags >= 0 else {