Repository: apple/swift-nio Branch: main Commit: 66c50a79a393 Files: 766 Total size: 8.5 MB Directory structure: gitextract_lx9o5bau/ ├── .editorconfig ├── .git-blame-ignore-revs ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ └── bug-report.md │ ├── PULL_REQUEST_TEMPLATE.md │ ├── actions/ │ │ └── pull_request_semver_label_checker/ │ │ └── action.yml │ ├── dependabot.yml │ ├── release.yml │ └── workflows/ │ ├── android_swift_sdk.yml │ ├── benchmarks.yml │ ├── cmake_tests.yml │ ├── cxx_interop.yml │ ├── macos_benchmarks.yml │ ├── macos_tests.yml │ ├── main.yml │ ├── pull_request.yml │ ├── pull_request_label.yml │ ├── release_builds.yml │ ├── static_sdk.yml │ ├── swift_6_language_mode.yml │ ├── swift_load_test_matrix.yml │ ├── swift_matrix.yml │ ├── swift_test_matrix.yml │ ├── unit_tests.yml │ └── wasm_swift_sdk.yml ├── .gitignore ├── .licenseignore ├── .mailfilter ├── .mailmap ├── .spi.yml ├── .swift-format ├── Benchmarks/ │ ├── .gitignore │ ├── Benchmarks/ │ │ ├── NIOCoreBenchmarks/ │ │ │ └── Benchmarks.swift │ │ └── NIOPosixBenchmarks/ │ │ ├── Benchmarks.swift │ │ ├── NIOThreadPoolBenchmark.swift │ │ ├── TCPEcho.swift │ │ ├── TCPEchoAsyncChannel.swift │ │ ├── UDPEcho.swift │ │ └── Util/ │ │ └── GlobalExecutor.swift │ ├── Package.swift │ └── Thresholds/ │ ├── 5.10/ │ │ ├── NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json │ │ ├── NIOCoreBenchmarks.WaitOnPromise.p90.json │ │ ├── NIOPosixBenchmarks.TCPEcho.p90.json │ │ └── NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json │ ├── 6.0/ │ │ ├── NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json │ │ ├── NIOPosixBenchmarks.TCPEcho.p90.json │ │ └── NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json │ ├── 6.1/ │ │ ├── NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json │ │ ├── NIOPosixBenchmarks.TCPEcho.p90.json │ │ └── NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json │ ├── 6.2/ │ │ ├── NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json │ │ ├── NIOPosixBenchmarks.TCPEcho.p90.json │ │ └── NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json │ ├── nightly-main/ │ │ ├── NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json │ │ ├── NIOPosixBenchmarks.TCPEcho.p90.json │ │ └── NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json │ └── nightly-next/ │ ├── NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json │ ├── NIOPosixBenchmarks.TCPEcho.p90.json │ └── NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTORS.txt ├── IntegrationTests/ │ ├── allocation-counter-tests-framework/ │ │ ├── run-allocation-counter.sh │ │ └── template/ │ │ ├── AtomicCounter/ │ │ │ ├── Package.swift │ │ │ └── Sources/ │ │ │ └── AtomicCounter/ │ │ │ ├── include/ │ │ │ │ └── atomic-counter.h │ │ │ └── src/ │ │ │ └── atomic-counter.c │ │ ├── HookedFunctionsDoHook/ │ │ │ ├── Package.swift │ │ │ └── Sources/ │ │ │ └── HookedFunctions/ │ │ │ ├── include/ │ │ │ │ └── hooked-functions.h │ │ │ └── src/ │ │ │ ├── hooked-functions-darwin.c │ │ │ └── hooked-functions-unix.c │ │ ├── HookedFunctionsDoNotHook/ │ │ │ ├── Package.swift │ │ │ └── Sources/ │ │ │ └── HookedFunctions/ │ │ │ ├── include/ │ │ │ │ └── hooked-functions.h │ │ │ └── src/ │ │ │ └── hooked-functions.c │ │ ├── Sources/ │ │ │ ├── bootstrapDoHook/ │ │ │ │ └── main.c │ │ │ └── bootstrapDoNotHook/ │ │ │ └── main.c │ │ └── scaffolding.swift │ ├── plugin_echo.sh │ ├── plugin_junit_xml.sh │ ├── run-single-test.sh │ ├── run-tests.sh │ ├── test_functions.sh │ ├── tests_01_http/ │ │ ├── defines.sh │ │ ├── test_01_get_file.sh │ │ ├── test_02_get_random_bytes.sh │ │ ├── test_03_post_random_bytes.sh │ │ ├── test_04_keep_alive_works.sh │ │ ├── test_05_repeated_reqs_work.sh │ │ ├── test_06_http_1.0.sh │ │ ├── test_07_headers_work.sh │ │ ├── test_08_survive_signals.sh │ │ ├── test_09_curl_happy_with_trailers.sh │ │ ├── test_10_connection_drop_in_body_ok.sh │ │ ├── test_11_res_body_streaming.sh │ │ ├── test_12_headers_too_large.sh │ │ ├── test_13_http_pipelining.sh │ │ ├── test_14_strict_mode_assertion.sh │ │ ├── test_15_post_in_chunked_encoding.sh │ │ ├── test_16_tcp_client_ip.sh │ │ ├── test_17_serve_massive_sparse_file.sh │ │ ├── test_18_close_with_no_keepalive.sh │ │ ├── test_19_connection_drop_while_waiting_for_response_uds.sh │ │ ├── test_20_connection_drop_while_waiting_for_response_tcp.sh │ │ ├── test_21_connection_reset_tcp.sh │ │ ├── test_22_http_1.0_keep_alive.sh │ │ ├── test_23_repeated_reqs_with_half_closure.sh │ │ └── test_24_http_over_stdio.sh │ ├── tests_02_syscall_wrappers/ │ │ ├── defines.sh │ │ ├── test_01_syscall_wrapper_fast.sh │ │ ├── test_02_unacceptable_errnos.sh │ │ └── test_03_unacceptable_read_errnos.sh │ ├── tests_03_debug_binary_checks/ │ │ ├── defines.sh │ │ ├── test_01_check_we_do_not_link_Foundation.sh │ │ └── test_02_expected_crashes_work.sh │ ├── tests_04_performance/ │ │ ├── Thresholds/ │ │ │ ├── 5.10.json │ │ │ ├── 5.8.json │ │ │ ├── 6.0.json │ │ │ ├── 6.1.json │ │ │ ├── 6.2.json │ │ │ ├── nightly-main.json │ │ │ └── nightly-next.json │ │ ├── defines.sh │ │ ├── test_01_allocation_counts.sh │ │ └── test_01_resources/ │ │ ├── README.md │ │ ├── run-nio-alloc-counter-tests.sh │ │ ├── shared.swift │ │ ├── test_10000000_asyncsequenceproducer.swift │ │ ├── test_1000000_asyncwriter.swift │ │ ├── test_1000_addHandlers.swift │ │ ├── test_1000_addHandlers_sync.swift │ │ ├── test_1000_addRemoveHandlers.swift │ │ ├── test_1000_autoReadGetAndSet.swift │ │ ├── test_1000_autoReadGetAndSet_sync.swift │ │ ├── test_1000_copying_bytebufferview_to_array.swift │ │ ├── test_1000_copying_circularbuffer_to_array.swift │ │ ├── test_1000_getHandlers.swift │ │ ├── test_1000_getHandlers_sync.swift │ │ ├── test_1000_reqs_1_conn.swift │ │ ├── test_1000_rst_connections.swift │ │ ├── test_1000_tcpbootstraps.swift │ │ ├── test_1000_tcpconnections.swift │ │ ├── test_1000_udp_reqs.swift │ │ ├── test_1000_udpbootstraps.swift │ │ ├── test_1000_udpconnections.swift │ │ ├── test_1_reqs_1000_conn.swift │ │ ├── test_assume_isolated_scheduling_10000_executions.swift │ │ ├── test_bytebuffer_lots_of_rw.swift │ │ ├── test_creating_10000_headers.swift │ │ ├── test_decode_1000_ws_frames.swift │ │ ├── test_encode_1000_ws_frames.swift │ │ ├── test_execute_hop_10000_tasks.swift │ │ ├── test_flat_schedule_10000_tasks.swift │ │ ├── test_flat_schedule_assume_isolated_10000_tasks.swift │ │ ├── test_future_assume_isolated_lots_of_callbacks.swift │ │ ├── test_future_erase_result.swift │ │ ├── test_future_lots_of_callbacks.swift │ │ ├── test_get_100000_headers_canonical_form.swift │ │ ├── test_modifying_1000_circular_buffer_elements.swift │ │ ├── test_modifying_byte_buffer_view.swift │ │ ├── test_ping_pong_1000_reqs_1_conn.swift │ │ ├── test_read_10000_chunks_from_file.swift │ │ ├── test_schedule_10000_tasks.swift │ │ ├── test_schedule_and_run_10000_tasks.swift │ │ ├── test_schedule_assume_isolated_10000_tasks.swift │ │ ├── test_schedule_with_deadline_10000_tasks.swift │ │ ├── test_schedule_with_deadline_assume_isolated_10000_tasks.swift │ │ ├── test_scheduling_10000_executions.swift │ │ ├── test_submit_10000_tasks.swift │ │ ├── test_submit_assume_isolated_10000_tasks.swift │ │ ├── test_udp_1000_reqs_1_conn.swift │ │ └── test_udp_1_reqs_1000_conn.swift │ └── tests_05_assertions/ │ ├── defines.sh │ └── test_01_syscall_wrapper_fast.sh ├── LICENSE.txt ├── NOTICE.txt ├── Package.swift ├── README.md ├── SECURITY.md ├── Snippets/ │ └── NIOFileSystemTour.swift ├── Sources/ │ ├── CNIOAtomics/ │ │ ├── include/ │ │ │ └── CNIOAtomics.h │ │ └── src/ │ │ ├── c-atomics.c │ │ ├── c-nioatomics.c │ │ └── cpp_magic.h │ ├── CNIODarwin/ │ │ ├── include/ │ │ │ └── CNIODarwin.h │ │ └── shim.c │ ├── CNIOLLHTTP/ │ │ ├── LICENSE │ │ ├── c_nio_api.c │ │ ├── c_nio_http.c │ │ ├── c_nio_llhttp.c │ │ ├── include/ │ │ │ ├── CNIOLLHTTP.h │ │ │ └── c_nio_llhttp.h │ │ └── update_and_patch_llhttp.sh │ ├── CNIOLinux/ │ │ ├── include/ │ │ │ ├── CNIOLinux.h │ │ │ └── liburing_nio.h │ │ ├── liburing_shims.c │ │ └── shim.c │ ├── CNIOOpenBSD/ │ │ ├── include/ │ │ │ └── CNIOOpenBSD.h │ │ └── shim.c │ ├── CNIOPosix/ │ │ ├── event_loop_id.c │ │ └── include/ │ │ └── CNIOPosix.h │ ├── CNIOSHA1/ │ │ ├── c_nio_sha1.c │ │ ├── include/ │ │ │ └── CNIOSHA1.h │ │ └── update_and_patch_sha1.sh │ ├── CNIOWASI/ │ │ ├── CNIOWASI.c │ │ └── include/ │ │ └── CNIOWASI.h │ ├── CNIOWindows/ │ │ ├── WSAStartup.c │ │ ├── include/ │ │ │ ├── CNIOWindows.h │ │ │ └── module.modulemap │ │ └── shim.c │ ├── NIO/ │ │ ├── Docs.docc/ │ │ │ ├── Articles/ │ │ │ │ ├── Debugging Allocation Regressions.md │ │ │ │ └── Running Alloction Counting Tests.md │ │ │ └── index.md │ │ └── Exports.swift │ ├── NIOAsyncAwaitDemo/ │ │ ├── AsyncChannelIO.swift │ │ ├── FullRequestResponse.swift │ │ └── main.swift │ ├── NIOChatClient/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOChatServer/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOConcurrencyHelpers/ │ │ ├── NIOAtomic.swift │ │ ├── NIOLock.swift │ │ ├── NIOLockedValueBox.swift │ │ ├── NIOThreadPoolWorkAvailable.swift │ │ ├── atomics.swift │ │ └── lock.swift │ ├── NIOCore/ │ │ ├── AddressedEnvelope.swift │ │ ├── AsyncAwaitSupport.swift │ │ ├── AsyncChannel/ │ │ │ ├── AsyncChannel.swift │ │ │ ├── AsyncChannelHandler.swift │ │ │ ├── AsyncChannelInboundStream.swift │ │ │ └── AsyncChannelOutboundWriter.swift │ │ ├── AsyncSequences/ │ │ │ ├── NIOAsyncSequenceProducer.swift │ │ │ ├── NIOAsyncSequenceProducerStrategies.swift │ │ │ ├── NIOAsyncWriter.swift │ │ │ └── NIOThrowingAsyncSequenceProducer.swift │ │ ├── BSDSocketAPI.swift │ │ ├── ByteBuffer-aux.swift │ │ ├── ByteBuffer-binaryEncodedLengthPrefix.swift │ │ ├── ByteBuffer-conversions.swift │ │ ├── ByteBuffer-core.swift │ │ ├── ByteBuffer-hex.swift │ │ ├── ByteBuffer-int.swift │ │ ├── ByteBuffer-lengthPrefix.swift │ │ ├── ByteBuffer-multi-int.swift │ │ ├── ByteBuffer-quicBinaryEncodingStrategy.swift │ │ ├── ByteBuffer-views.swift │ │ ├── Channel.swift │ │ ├── ChannelHandler.swift │ │ ├── ChannelHandlers.swift │ │ ├── ChannelInvoker.swift │ │ ├── ChannelOption.swift │ │ ├── ChannelPipeline.swift │ │ ├── CircularBuffer.swift │ │ ├── Codec.swift │ │ ├── ConvenienceOptionSupport.swift │ │ ├── DeadChannel.swift │ │ ├── DispatchQueue+WithFuture.swift │ │ ├── Docs.docc/ │ │ │ ├── ByteBuffer-lengthPrefix.md │ │ │ ├── index.md │ │ │ ├── loops-futures-concurrency.md │ │ │ └── swift-concurrency.md │ │ ├── EventLoop+Deprecated.swift │ │ ├── EventLoop+SerialExecutor.swift │ │ ├── EventLoop.swift │ │ ├── EventLoopFuture+AssumeIsolated.swift │ │ ├── EventLoopFuture+Deprecated.swift │ │ ├── EventLoopFuture+WithEventLoop.swift │ │ ├── EventLoopFuture.swift │ │ ├── FileDescriptor.swift │ │ ├── FileHandle.swift │ │ ├── FileRegion.swift │ │ ├── GlobalSingletons.swift │ │ ├── IO.swift │ │ ├── IOData.swift │ │ ├── IPProtocol.swift │ │ ├── IntegerBitPacking.swift │ │ ├── IntegerTypes.swift │ │ ├── Interfaces.swift │ │ ├── Linux.swift │ │ ├── MarkedCircularBuffer.swift │ │ ├── MulticastChannel.swift │ │ ├── NIOAny.swift │ │ ├── NIOCloseOnErrorHandler.swift │ │ ├── NIOCoreSendableMetatype.swift │ │ ├── NIODecodedAsyncSequence.swift │ │ ├── NIOLoopBound.swift │ │ ├── NIOPooledRecvBufferAllocator.swift │ │ ├── NIOScheduledCallback.swift │ │ ├── NIOSendable.swift │ │ ├── NIOSplitLinesMessageDecoder.swift │ │ ├── NIOTransportAccessibleChannelCore.swift │ │ ├── RecvByteBufferAllocator.swift │ │ ├── SingleStepByteToMessageDecoder.swift │ │ ├── SocketAddresses.swift │ │ ├── SocketOptionProvider.swift │ │ ├── SystemCallHelpers.swift │ │ ├── TimeAmount+Duration.swift │ │ ├── TypeAssistedChannelHandler.swift │ │ ├── UniversalBootstrapSupport.swift │ │ └── Utilities.swift │ ├── NIOCrashTester/ │ │ ├── CrashTestSuites.swift │ │ ├── CrashTests+ByteBuffer.swift │ │ ├── CrashTests+EventLoop.swift │ │ ├── CrashTests+HTTP.swift │ │ ├── CrashTests+LoopBound.swift │ │ ├── CrashTests+Strict.swift │ │ ├── CrashTests+System.swift │ │ ├── OutputGrepper.swift │ │ └── main.swift │ ├── NIOEchoClient/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOEchoServer/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOEmbedded/ │ │ ├── AsyncTestingChannel.swift │ │ ├── AsyncTestingEventLoop.swift │ │ └── Embedded.swift │ ├── NIOFS/ │ │ ├── Array+FileSystem.swift │ │ ├── ArraySlice+FileSystem.swift │ │ ├── BufferedReader.swift │ │ ├── BufferedWriter.swift │ │ ├── ByteBuffer+FileSystem.swift │ │ ├── ByteCount.swift │ │ ├── Convenience.swift │ │ ├── DirectoryEntries.swift │ │ ├── DirectoryEntry.swift │ │ ├── Exports.swift │ │ ├── FileChunks.swift │ │ ├── FileHandle.swift │ │ ├── FileHandleProtocol.swift │ │ ├── FileInfo.swift │ │ ├── FileSystem.swift │ │ ├── FileSystemError+Syscall.swift │ │ ├── FileSystemError.swift │ │ ├── FileSystemProtocol.swift │ │ ├── FileType.swift │ │ ├── IOStrategy.swift │ │ ├── Internal/ │ │ │ ├── BufferedOrAnyStream.swift │ │ │ ├── BufferedStream.swift │ │ │ ├── Cancellation.swift │ │ │ ├── Concurrency Primitives/ │ │ │ │ └── TokenBucket.swift │ │ │ ├── ParallelDirCopy.swift │ │ │ ├── ParallelRemoval.swift │ │ │ ├── String+UnsafeUnititializedCapacity.swift │ │ │ ├── System Calls/ │ │ │ │ ├── CInterop.swift │ │ │ │ ├── Errno.swift │ │ │ │ ├── FileDescriptor+Syscalls.swift │ │ │ │ ├── Mocking.swift │ │ │ │ ├── Syscall.swift │ │ │ │ └── Syscalls.swift │ │ │ ├── SystemFileHandle.swift │ │ │ └── Utilities.swift │ │ ├── NIOFilePath.swift │ │ ├── NIOFileSystemSendableMetatype.swift │ │ ├── OpenOptions.swift │ │ ├── PrivacyInfo.xcprivacy │ │ └── String+FileSystem.swift │ ├── NIOFSFoundationCompat/ │ │ ├── Data+FileSystem.swift │ │ └── Date+FileInfo.swift │ ├── NIOFileSystem/ │ │ ├── Docs.docc/ │ │ │ └── index.md │ │ └── Exports.swift │ ├── NIOFoundationCompat/ │ │ ├── ByteBuffer-foundation.swift │ │ ├── Codable+ByteBuffer.swift │ │ ├── JSONSerialization+ByteBuffer.swift │ │ └── WaitSpinningRunLoop.swift │ ├── NIOHTTP1/ │ │ ├── ByteCollectionUtils.swift │ │ ├── HTTPDecoder.swift │ │ ├── HTTPEncoder.swift │ │ ├── HTTPHeaderValidator.swift │ │ ├── HTTPHeaders+Validation.swift │ │ ├── HTTPPipelineSetup.swift │ │ ├── HTTPServerPipelineHandler.swift │ │ ├── HTTPServerProtocolErrorHandler.swift │ │ ├── HTTPServerUpgradeHandler.swift │ │ ├── HTTPTypedPipelineSetup.swift │ │ ├── HTTPTypes.swift │ │ ├── NIOHTTPClientUpgradeHandler.swift │ │ ├── NIOHTTPObjectAggregator.swift │ │ ├── NIOTypedHTTPClientUpgradeHandler.swift │ │ ├── NIOTypedHTTPClientUpgraderStateMachine.swift │ │ ├── NIOTypedHTTPServerUpgradeHandler.swift │ │ └── NIOTypedHTTPServerUpgraderStateMachine.swift │ ├── NIOHTTP1Client/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOHTTP1Server/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOMulticastChat/ │ │ └── main.swift │ ├── NIOPerformanceTester/ │ │ ├── Benchmark.swift │ │ ├── ByteBufferViewContainsBenchmark.swift │ │ ├── ByteBufferViewCopyToArrayBenchmark.swift │ │ ├── ByteBufferViewIteratorBenchmark.swift │ │ ├── ByteBufferWriteMultipleBenchmarks.swift │ │ ├── ByteToMessageDecoderDecodeManySmallsBenchmark.swift │ │ ├── ChannelPipelineBenchmark.swift │ │ ├── ChannelPipelineInstantiationBenchmark.swift │ │ ├── CircularBufferCopyToArrayBenchmark.swift │ │ ├── CircularBufferIntoByteBufferBenchmark.swift │ │ ├── DeadlineNowBenchmark.swift │ │ ├── ExecuteBenchmark.swift │ │ ├── LockBenchmark.swift │ │ ├── NIOAsyncSequenceProducerBenchmark.swift │ │ ├── NIOAsyncWriterSingleWritesBenchmark.swift │ │ ├── NIOThreadPoolSubmitBenchmark.swift │ │ ├── RunIfActiveBenchmark.swift │ │ ├── SchedulingAndRunningBenchmark.swift │ │ ├── TCPThroughputBenchmark.swift │ │ ├── UDPBenchmark.swift │ │ ├── WebSocketFrameDecoderBenchmark.swift │ │ ├── WebSocketFrameEncoderBenchmark.swift │ │ ├── main.swift │ │ └── resources.swift │ ├── NIOPosix/ │ │ ├── BSDSocketAPICommon.swift │ │ ├── BSDSocketAPIPosix.swift │ │ ├── BSDSocketAPIWindows.swift │ │ ├── BaseSocket.swift │ │ ├── BaseSocketChannel+AccessibleTransport.swift │ │ ├── BaseSocketChannel+SocketOptionProvider.swift │ │ ├── BaseSocketChannel.swift │ │ ├── BaseStreamSocketChannel.swift │ │ ├── Bootstrap.swift │ │ ├── ControlMessage.swift │ │ ├── DatagramVectorReadManager.swift │ │ ├── Docs.docc/ │ │ │ ├── GSO-GRO-Linux.md │ │ │ └── index.md │ │ ├── Errors+Any.swift │ │ ├── FileDescriptor.swift │ │ ├── GetaddrinfoResolver.swift │ │ ├── HappyEyeballs.swift │ │ ├── IO.swift │ │ ├── IntegerBitPacking.swift │ │ ├── IntegerTypes.swift │ │ ├── Linux.swift │ │ ├── LinuxCPUSet.swift │ │ ├── LinuxUring.swift │ │ ├── MultiThreadedEventLoopGroup.swift │ │ ├── NIOPosixSendableMetatype.swift │ │ ├── NIOThreadPool.swift │ │ ├── NonBlockingFileIO.swift │ │ ├── PendingDatagramWritesManager.swift │ │ ├── PendingWritesManager.swift │ │ ├── PipeChannel.swift │ │ ├── PipePair.swift │ │ ├── Pool.swift │ │ ├── PosixSingletons+ConcurrencyTakeOver.swift │ │ ├── PosixSingletons.swift │ │ ├── PrivacyInfo.xcprivacy │ │ ├── RawSocketBootstrap.swift │ │ ├── Resolver.swift │ │ ├── Selectable.swift │ │ ├── SelectableChannel.swift │ │ ├── SelectableEventLoop.swift │ │ ├── SelectorEpoll.swift │ │ ├── SelectorGeneric.swift │ │ ├── SelectorKqueue.swift │ │ ├── SelectorUring.swift │ │ ├── SelectorWSAPoll.swift │ │ ├── ServerSocket.swift │ │ ├── Socket.swift │ │ ├── SocketChannel.swift │ │ ├── SocketProtocols.swift │ │ ├── StructuredConcurrencyHelpers.swift │ │ ├── System.swift │ │ ├── Thread.swift │ │ ├── ThreadPosix.swift │ │ ├── ThreadWindows.swift │ │ ├── Utilities.swift │ │ ├── VsockAddress.swift │ │ ├── VsockChannelEvents.swift │ │ └── Windows.swift │ ├── NIOTCPEchoClient/ │ │ ├── Client.swift │ │ └── README.md │ ├── NIOTCPEchoServer/ │ │ ├── README.md │ │ └── Server.swift │ ├── NIOTLS/ │ │ ├── ApplicationProtocolNegotiationHandler.swift │ │ ├── NIOTypedApplicationProtocolNegotiationHandler.swift │ │ ├── ProtocolNegotiationHandlerStateMachine.swift │ │ ├── SNIHandler.swift │ │ └── TLSEvents.swift │ ├── NIOTestUtils/ │ │ ├── ByteToMessageDecoderVerifier.swift │ │ ├── EventCounterHandler.swift │ │ ├── ManualTaskExecutor.swift │ │ └── NIOHTTP1TestServer.swift │ ├── NIOUDPEchoClient/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOUDPEchoServer/ │ │ ├── README.md │ │ └── main.swift │ ├── NIOWebSocket/ │ │ ├── NIOWebSocketClientUpgrader.swift │ │ ├── NIOWebSocketFrameAggregator.swift │ │ ├── NIOWebSocketServerUpgrader.swift │ │ ├── SHA1.swift │ │ ├── WebSocketErrorCodes.swift │ │ ├── WebSocketFrame.swift │ │ ├── WebSocketFrameDecoder.swift │ │ ├── WebSocketFrameEncoder.swift │ │ ├── WebSocketOpcode.swift │ │ └── WebSocketProtocolErrorHandler.swift │ ├── NIOWebSocketClient/ │ │ ├── Client.swift │ │ └── README.md │ ├── NIOWebSocketServer/ │ │ ├── README.md │ │ └── Server.swift │ ├── _NIOBase64/ │ │ └── Base64.swift │ ├── _NIOConcurrency/ │ │ └── Empty.swift │ ├── _NIODataStructures/ │ │ ├── Heap.swift │ │ ├── PriorityQueue.swift │ │ └── _TinyArray.swift │ ├── _NIOFileSystem/ │ │ ├── Array+FileSystem.swift │ │ ├── ArraySlice+FileSystem.swift │ │ ├── BufferedReader.swift │ │ ├── BufferedWriter.swift │ │ ├── ByteBuffer+FileSystem.swift │ │ ├── ByteCount.swift │ │ ├── Convenience.swift │ │ ├── DirectoryEntries.swift │ │ ├── DirectoryEntry.swift │ │ ├── Docs.docc/ │ │ │ ├── Extensions/ │ │ │ │ ├── DirectoryFileHandleProtocol.md │ │ │ │ ├── FileHandleProtocol.md │ │ │ │ ├── FileSystemProtocol.md │ │ │ │ ├── ReadableFileHandleProtocol.md │ │ │ │ └── WritableFileHandleProtocol.md │ │ │ └── index.md │ │ ├── Exports.swift │ │ ├── FileChunks.swift │ │ ├── FileHandle.swift │ │ ├── FileHandleProtocol.swift │ │ ├── FileInfo.swift │ │ ├── FileSystem.swift │ │ ├── FileSystemError+Syscall.swift │ │ ├── FileSystemError.swift │ │ ├── FileSystemProtocol.swift │ │ ├── FileType.swift │ │ ├── IOStrategy.swift │ │ ├── Internal/ │ │ │ ├── BufferedOrAnyStream.swift │ │ │ ├── BufferedStream.swift │ │ │ ├── Cancellation.swift │ │ │ ├── Concurrency Primitives/ │ │ │ │ └── TokenBucket.swift │ │ │ ├── ParallelDirCopy.swift │ │ │ ├── ParallelRemoval.swift │ │ │ ├── String+UnsafeUnititializedCapacity.swift │ │ │ ├── System Calls/ │ │ │ │ ├── CInterop.swift │ │ │ │ ├── Errno.swift │ │ │ │ ├── FileDescriptor+Syscalls.swift │ │ │ │ ├── Mocking.swift │ │ │ │ ├── Syscall.swift │ │ │ │ └── Syscalls.swift │ │ │ ├── SystemFileHandle.swift │ │ │ └── Utilities.swift │ │ ├── NIOFilePath.swift │ │ ├── NIOFileSystemSendableMetatype.swift │ │ ├── OpenOptions.swift │ │ ├── PrivacyInfo.xcprivacy │ │ └── String+FileSystem.swift │ └── _NIOFileSystemFoundationCompat/ │ ├── Data+FileSystem.swift │ └── Date+FileInfo.swift ├── Tests/ │ ├── NIOBase64Tests/ │ │ └── Base64Test.swift │ ├── NIOConcurrencyHelpersTests/ │ │ └── NIOConcurrencyHelpersTests.swift │ ├── NIOCoreTests/ │ │ ├── AddressedEnvelopeTests.swift │ │ ├── AsyncChannel/ │ │ │ ├── AsyncChannelInboundStreamTests.swift │ │ │ ├── AsyncChannelOutboundWriterTests.swift │ │ │ └── AsyncChannelTests.swift │ │ ├── AsyncSequenceTests.swift │ │ ├── AsyncSequences/ │ │ │ ├── NIOAsyncSequenceProducer+HighLowWatermarkBackPressureStrategyTests.swift │ │ │ ├── NIOAsyncSequenceTests.swift │ │ │ ├── NIOAsyncWriterTests.swift │ │ │ └── NIOThrowingAsyncSequenceTests.swift │ │ ├── BaseObjectsTest.swift │ │ ├── ByteBufferBinaryEncodedLengthPrefixTests.swift │ │ ├── ByteBufferCustomAllocatorTest.swift │ │ ├── ByteBufferLengthPrefixTests.swift │ │ ├── ByteBufferQUICBinaryEncodingStrategyTests.swift │ │ ├── ByteBufferSpanTests.swift │ │ ├── ByteBufferTest.swift │ │ ├── ChannelOptionStorageTest.swift │ │ ├── CircularBufferTests.swift │ │ ├── CustomChannelTests.swift │ │ ├── DispatchQueue+WithFutureTest.swift │ │ ├── IOErrorTest.swift │ │ ├── IntegerTypesTest.swift │ │ ├── LinuxTest.swift │ │ ├── MarkedCircularBufferTests.swift │ │ ├── NIOAnyDebugTest.swift │ │ ├── NIOCloseOnErrorHandlerTest.swift │ │ ├── NIODecodedAsyncSequenceTests.swift │ │ ├── NIOIsolatedEventLoopTests.swift │ │ ├── NIOPooledRecvBufferAllocatorTests.swift │ │ ├── NIOSplitLinesMessageDecoderTests.swift │ │ ├── RecvByteBufAllocatorTest.swift │ │ ├── SingleStepByteToMessageDecoderTest.swift │ │ ├── TimeAmount+DurationTests.swift │ │ ├── TimeAmountTests.swift │ │ ├── TypeAssistedChannelHandlerTests.swift │ │ ├── UtilitiesTest.swift │ │ ├── XCTest+AsyncAwait.swift │ │ └── XCTest+Extensions.swift │ ├── NIODataStructuresTests/ │ │ ├── HeapTests.swift │ │ └── PriorityQueueTests.swift │ ├── NIOEmbeddedTests/ │ │ ├── AsyncTestingChannelTests.swift │ │ ├── AsyncTestingEventLoopTests.swift │ │ ├── EmbeddedChannelTest.swift │ │ ├── EmbeddedEventLoopTest.swift │ │ ├── TestUtils.swift │ │ └── XCTest+AsyncAwait.swift │ ├── NIOFSFoundationCompatTests/ │ │ └── FileSystemFoundationCompatTests.swift │ ├── NIOFSIntegrationTests/ │ │ ├── BufferedReaderTests.swift │ │ ├── BufferedWriterTests.swift │ │ ├── ConvenienceTests.swift │ │ ├── FileHandleTests.swift │ │ ├── FileSystemTests+SPI.swift │ │ ├── FileSystemTests.swift │ │ ├── Test Data/ │ │ │ ├── Foo/ │ │ │ │ └── README.txt │ │ │ └── README.md │ │ └── XCTestExtensions.swift │ ├── NIOFSTests/ │ │ ├── ByteCountTests.swift │ │ ├── DirectoryEntriesTests.swift │ │ ├── FileChunksTests.swift │ │ ├── FileHandleTests.swift │ │ ├── FileInfoTests.swift │ │ ├── FileOpenOptionsTests.swift │ │ ├── FilePathTests.swift │ │ ├── FileSystemErrorTests.swift │ │ ├── FileTypeTests.swift │ │ ├── Internal/ │ │ │ ├── CancellationTests.swift │ │ │ ├── Concurrency Primitives/ │ │ │ │ └── BufferedStreamTests.swift │ │ │ ├── MockingInfrastructure.swift │ │ │ └── SyscallTests.swift │ │ └── XCTestExtensions.swift │ ├── NIOFoundationCompatTests/ │ │ ├── ByteBuffer+UUIDTests.swift │ │ ├── ByteBufferDataProtocolTests.swift │ │ ├── ByteBufferView+MutableDataProtocolTest.swift │ │ ├── Codable+ByteBufferTest.swift │ │ ├── JSONSerialization+ByteBufferTest.swift │ │ └── WaitSpinningRunLoopTests.swift │ ├── NIOHTTP1Tests/ │ │ ├── ByteBufferUtilsTest.swift │ │ ├── ContentLengthTests.swift │ │ ├── HTTPClientUpgradeTests.swift │ │ ├── HTTPDecoderLengthTest.swift │ │ ├── HTTPDecoderTest.swift │ │ ├── HTTPHeaderValidationTests.swift │ │ ├── HTTPHeadersTest.swift │ │ ├── HTTPRequestEncoderTest.swift │ │ ├── HTTPResponseEncoderTest.swift │ │ ├── HTTPResponseStatusTests.swift │ │ ├── HTTPServerClientTest.swift │ │ ├── HTTPServerPipelineHandlerTest.swift │ │ ├── HTTPServerProtocolErrorHandlerTest.swift │ │ ├── HTTPServerUpgradeTests.swift │ │ ├── HTTPTest.swift │ │ ├── HTTPTypesTest.swift │ │ ├── NIOHTTPObjectAggregatorTest.swift │ │ └── TestUtils.swift │ ├── NIOPosixTests/ │ │ ├── AcceptBackoffHandlerTest.swift │ │ ├── AsyncChannelBootstrapTests.swift │ │ ├── BlockingIOThreadPoolTest.swift │ │ ├── BootstrapTest.swift │ │ ├── ChannelNotificationTest.swift │ │ ├── ChannelPipelineTest.swift │ │ ├── ChannelTests.swift │ │ ├── CoWValue.swift │ │ ├── CodecTest.swift │ │ ├── ControlMessageTests.swift │ │ ├── DatagramChannelTests.swift │ │ ├── EchoServerClientTest.swift │ │ ├── EventLoopFutureIsolatedTests.swift │ │ ├── EventLoopFutureTest.swift │ │ ├── EventLoopMetricsDelegateTests.swift │ │ ├── EventLoopTest.swift │ │ ├── FileRegionTest.swift │ │ ├── GetAddrInfoResolverTest.swift │ │ ├── HappyEyeballsTest.swift │ │ ├── IPv4Header.swift │ │ ├── IdleStateHandlerTest.swift │ │ ├── IntegerBitPackingTests.swift │ │ ├── MulticastTest.swift │ │ ├── NIOFileHandleTest.swift │ │ ├── NIOLoopBoundTests.swift │ │ ├── NIOScheduledCallbackTests.swift │ │ ├── NIOThreadPoolTest.swift │ │ ├── NIOTransportAccessibleChannelCoreTests.swift │ │ ├── NonBlockingFileIOTest.swift │ │ ├── PendingDatagramWritesManagerTests.swift │ │ ├── PipeChannelTest.swift │ │ ├── RawSocketBootstrapTests.swift │ │ ├── SALChannelTests.swift │ │ ├── SALEventLoopTests.swift │ │ ├── SelectorTest.swift │ │ ├── SerialExecutorTests.swift │ │ ├── SocketAddressTest.swift │ │ ├── SocketChannelTest.swift │ │ ├── SocketOptionProviderTest.swift │ │ ├── StreamChannelsTest.swift │ │ ├── SyscallAbstractionLayer.swift │ │ ├── SyscallAbstractionLayerContext.swift │ │ ├── SystemCallWrapperHelpers.swift │ │ ├── SystemTest.swift │ │ ├── TestUtils.swift │ │ ├── ThreadTest.swift │ │ ├── UniversalBootstrapSupportTest.swift │ │ ├── VsockAddressTest.swift │ │ └── XCTest+AsyncAwait.swift │ ├── NIOSingletonsTests/ │ │ └── GlobalSingletonsTests.swift │ ├── NIOTLSTests/ │ │ ├── ApplicationProtocolNegotiationHandlerTests.swift │ │ ├── NIOTypedApplicationProtocolNegotiationHandlerTests.swift │ │ └── SNIHandlerTests.swift │ ├── NIOTestUtilsTests/ │ │ ├── ByteToMessageDecoderVerifierTest.swift │ │ ├── EventCounterHandlerTest.swift │ │ ├── ManualTaskExecutorTest.swift │ │ └── NIOHTTP1TestServerTest.swift │ ├── NIOTests/ │ │ └── NIOTests.swift │ └── NIOWebSocketTests/ │ ├── ByteBufferWebSocketTests.swift │ ├── NIOWebSocketClientUpgraderTests.swift │ ├── NIOWebSocketFrameAggregatorTests.swift │ ├── WebSocketClientEndToEndTests.swift │ ├── WebSocketFrameDecoderTest.swift │ ├── WebSocketFrameEncoderTest.swift │ ├── WebSocketMaskingKeyTests.swift │ └── WebSocketServerEndToEndTests.swift ├── dev/ │ ├── alloc-limits-from-test-output │ ├── boxed-existentials.d │ ├── generate-bytebuffer-multi-int.sh │ ├── git.commit.template │ ├── lldb-smoker │ ├── make-single-file-spm │ ├── malloc-aggregation.bt │ ├── malloc-aggregation.d │ ├── stackdiff/ │ │ ├── Package.swift │ │ ├── Sources/ │ │ │ ├── Stacks/ │ │ │ │ ├── AggregateStacks.swift │ │ │ │ ├── Parsing/ │ │ │ │ │ ├── BPFTraceParser.swift │ │ │ │ │ ├── DTraceParser.swift │ │ │ │ │ ├── HeaptrackParser.swift │ │ │ │ │ └── StackParser.swift │ │ │ │ └── Similarity.swift │ │ │ └── stackdiff/ │ │ │ ├── StackFormatter.swift │ │ │ ├── Stackdiff+Diff.swift │ │ │ ├── Stackdiff+Dump.swift │ │ │ ├── Stackdiff+Merge.swift │ │ │ └── Stackdiff.swift │ │ └── Tests/ │ │ └── StacksTests/ │ │ ├── AggregateStackTests.swift │ │ ├── DTraceParserTests.swift │ │ ├── HeaptrackParserTests.swift │ │ └── SimilarityTests.swift │ ├── stackdiff-dtrace.py │ ├── thresholds-from-benchmark-output.sh │ └── update-integration-test-thresholds.sh ├── docs/ │ ├── advanced-performance-analysis.md │ ├── debugging-allocations.md │ ├── io_uring.md │ ├── migration-guide-NIO1-to-NIO2.md │ ├── optimization-tips.md │ ├── public-api.md │ ├── public-async-nio-apis.md │ └── workarounds.md └── scripts/ ├── analyze_performance_results.rb ├── bench-alloc-counter.sh ├── check-cxx-interop-compatibility.sh ├── check-matrix-job.ps1 ├── check-matrix-job.sh ├── check_benchmark_thresholds.sh ├── cmake-build.sh ├── compare_perf_of_swift_versions.sh ├── generate_matrix.sh ├── install_android_ndk.sh ├── install_swift_prerequisites.sh ├── install_swift_sdk.sh ├── integration_tests.sh ├── nio-diagnose ├── swift-build-with-android-sdk.sh ├── swift-build-with-wasm-sdk.sh └── update-cmake-lists.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ root = true [*] indent_style = space indent_size = 4 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true ================================================ FILE: .git-blame-ignore-revs ================================================ # Adopt swift-format c9756e108351a1def2e2c83ff5ee6fb9bcbc3bbf ================================================ FILE: .gitattributes ================================================ Sources/CNIOHTTPParser/* linguist-vendored Sources/CNIOSHA1/* linguist-vendored Sources/CNIOLinux/ifaddrs-* linguist-vendored ================================================ FILE: .github/ISSUE_TEMPLATE/bug-report.md ================================================ --- name: Bug Report about: File a bug report to help us improve --- ### Expected behavior _[what you expected to happen]_ ### Actual behavior _[what actually happened]_ ### Steps to reproduce 1. ... 2. ... ### If possible, minimal yet complete reproducer code (or URL to code) _[anything to help us reproducing the issue]_ ### SwiftNIO version/commit hash _[the SwiftNIO tag/commit hash]_ ### System & version information Please provide at the very least your operating system and Swift version information. Ideally, run ``` scripts/nio-diagnose -o nio-diagnose.md PID_OF_YOUR_NIO_PROGRAM ``` and attach (or paste) the resulting file `nio-diagnose.md` into this bug report or send it to the SwiftNIO maintainers privately. ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ _[One line description of your change]_ ### Motivation: _[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]_ ### Modifications: _[Describe the modifications you've done.]_ ### Result: _[After your change, what will change.]_ ================================================ FILE: .github/actions/pull_request_semver_label_checker/action.yml ================================================ name: 'Pull request Semantic Version label checker' description: 'Checks that at least one Semantic Version label is applied to the pull request' inputs: token: description: 'A GitHub token' type: string default: ${{ github.token }} runs: using: "composite" steps: - name: Check labels if: ${{ !env.ACT }} shell: bash env: GH_TOKEN: ${{ inputs.token }} run: | gh pr view ${{ github.event.number }} --repo ${{ github.repository }} --json labels \ | jq -e '[.labels[].name] | any(. == "⚠️ semver/major" or . == "🆕 semver/minor" or . == "🔨 semver/patch" or . == "semver/none")' ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" ================================================ FILE: .github/release.yml ================================================ changelog: categories: - title: SemVer Major labels: - ⚠️ semver/major - title: SemVer Minor labels: - 🆕 semver/minor - title: SemVer Patch labels: - 🔨 semver/patch - title: Other Changes labels: - semver/none ================================================ FILE: .github/workflows/android_swift_sdk.yml ================================================ name: Android Swift SDK permissions: contents: read on: workflow_call: inputs: env_vars: type: string description: "Environment variables for jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" additional_command_arguments: type: string description: "Additional arguments passed to swift build (the Android Swift SDK will be specified). Defaults to empty." default: "" jobs: construct-matrix: name: Construct Android Swift SDK matrix runs-on: ubuntu-latest outputs: android-sdk-matrix: '${{ steps.generate-matrix.outputs.android-sdk-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate and use JSON environment variables directly env_vars_json="$INPUT_ENV_VARS" # Validate JSON format if ! echo "$env_vars_json" | jq empty 2>/dev/null; then echo "Error: env_vars is not valid JSON" exit 1 fi # Generate matrix with parsed environment variables cat >> "$GITHUB_OUTPUT" << EOM android-sdk-matrix=$(echo '{ "config":[ { "name":"main Jammy", "swift_version":"main", "platform":"Linux", "runner":"ubuntu-latest", "image":"ubuntu:jammy", "setup_command":"apt update -q && apt install -y -q curl jq tar && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_prerequisites.sh | bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh | INSTALL_SWIFT_BRANCH=main INSTALL_SWIFT_ARCH=x86_64 INSTALL_SWIFT_SDK=android-sdk bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_android_ndk.sh | bash && hash -r", "command":"curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/swift-build-with-android-sdk.sh | bash -s --", "command_arguments":"'"$INPUT_ADDITIONAL_COMMAND_ARGUMENTS"'", "env":'"$env_vars_json"' } ] }' | jq -c) EOM env: INPUT_ENV_VARS: ${{ inputs.env_vars }} INPUT_ADDITIONAL_COMMAND_ARGUMENTS: ${{ inputs.additional_command_arguments }} android-swift-sdk: name: Android Swift SDK needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Android Swift SDK" matrix_string: '${{ needs.construct-matrix.outputs.android-sdk-matrix }}' ================================================ FILE: .github/workflows/benchmarks.yml ================================================ name: Benchmarks permissions: contents: read on: workflow_call: inputs: benchmark_package_path: type: string description: "Path to the directory containing the benchmarking package. Defaults to ." default: "." swift_package_arguments: type: string description: "Arguments to the switch package command invocation e.g. `--disable-sandbox`" linux_5_9_enabled: type: boolean description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to false." default: false linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to false." default: false linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." default: true linux_6_1_enabled: type: boolean description: "Boolean to enable the Linux 6.1 Swift version matrix job. Defaults to true." default: true linux_6_2_enabled: type: boolean description: "Boolean to enable the Linux 6.2 Swift version matrix job. Defaults to true." default: true linux_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: false linux_nightly_6_1_enabled: type: boolean description: "⚠️ Deprecated, use linux_nightly_next_enabled." default: true linux_nightly_next_enabled: type: boolean description: "Boolean to enable the Linux nightly matrix job for the next Swift version. Defaults to true." default: true linux_nightly_main_enabled: type: boolean description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." default: true windows_6_0_enabled: type: boolean description: "Boolean to enable the Windows 6.0 Swift version matrix job. Currently has no effect!" # TODO: implement Windows benchmarking default: false windows_6_1_enabled: type: boolean description: "Boolean to enable the Windows 6.1 Swift version matrix job. Currently has no effect!" # TODO: implement Windows benchmarking default: false windows_6_2_enabled: type: boolean description: "Boolean to enable the Windows 6.2 Swift version matrix job. Currently has no effect!" # TODO: implement Windows benchmarking default: false windows_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." # TODO: implement Windows benchmarking default: false windows_nightly_main_enabled: type: boolean description: "Boolean to enable the Windows nightly main Swift version matrix job. Currently has no effect!" # TODO: implement Windows benchmarking default: false linux_env_vars: type: string description: "Environment variables for Linux jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" minimum_swift_version: type: string description: "Minimum Swift version to include in the matrix. Leave empty for auto-detection from Package.swift, specify a version like '6.0' to override, or set to 'none' to disable filtering." default: "" jobs: construct-matrix-linux: name: Construct Linux Benchmarks matrix runs-on: ubuntu-latest outputs: benchmarks-matrix: '${{ steps.generate-matrix.outputs.benchmarks-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate JSON environment variables linux_env_vars_json="$INPUT_LINUX_ENV_VARS" if ! echo "$linux_env_vars_json" | jq empty 2>/dev/null; then echo "Error: linux_env_vars is not valid JSON" exit 1 fi echo "benchmarks-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | MATRIX_LINUX_ENV_VARS_JSON="${linux_env_vars_json}" bash)" >> "$GITHUB_OUTPUT" env: INPUT_LINUX_ENV_VARS: ${{ inputs.linux_env_vars }} MATRIX_LINUX_COMMAND: "curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check_benchmark_thresholds.sh | BENCHMARK_PACKAGE_PATH=${{ inputs.benchmark_package_path }} bash" MATRIX_LINUX_SETUP_COMMAND: "swift --version && apt-get update -y -q && apt-get install -y -q curl libjemalloc-dev && git config --global --add safe.directory /$(basename ${{ github.workspace }})" MATRIX_MIN_SWIFT_VERSION: ${{ inputs.minimum_swift_version }} MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }} MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }} MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }} MATRIX_LINUX_6_1_ENABLED: ${{ inputs.linux_6_1_enabled }} MATRIX_LINUX_6_2_ENABLED: ${{ inputs.linux_6_2_enabled }} MATRIX_LINUX_NIGHTLY_NEXT_ENABLED: ${{ inputs.linux_nightly_6_1_enabled && inputs.linux_nightly_next_enabled }} MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }} benchmarks-linux: name: Benchmarks needs: construct-matrix-linux # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Benchmarks" matrix_string: '${{ needs.construct-matrix-linux.outputs.benchmarks-matrix }}' ================================================ FILE: .github/workflows/cmake_tests.yml ================================================ name: CMake build permissions: contents: read on: workflow_call: inputs: update_cmake_lists_config: type: string description: "The configuration used when updating the CMake lists." required: true cmake_build_target_directory: type: string description: "The directory to pass to `cmake build`." default: "." cmake_version: type: string description: "The version of CMake to install." default: "" image: type: string description: "The docker image to run the checks in." default: "swift:6.0-jammy" jobs: cmake-checks: name: CMake checks runs-on: ubuntu-latest container: image: ${{ inputs.image }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Mark the workspace as safe # https://github.com/actions/checkout/issues/766 run: git config --global --add safe.directory ${GITHUB_WORKSPACE} - name: Check CMakeLists files run: | which curl jq || apt -q update which curl || apt -yq install curl which jq || apt -yq install jq curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/update-cmake-lists.sh | CONFIG_JSON="$INPUT_UPDATE_CMAKE_LISTS_CONFIG" FAIL_ON_CHANGES=true bash env: INPUT_UPDATE_CMAKE_LISTS_CONFIG: ${{ inputs.update_cmake_lists_config }} - name: CMake build run: | which curl cmake ninja || apt -q update which curl || apt -yq install curl which cmake || apt -yq install cmake which ninja || apt -yq install ninja-build curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/cmake-build.sh | TARGET_DIRECTORY="$INPUT_CMAKE_BUILD_TARGET_DIRECTORY" CMAKE_VERSION="$INPUT_CMAKE_VERSION" bash env: INPUT_CMAKE_BUILD_TARGET_DIRECTORY: ${{ inputs.cmake_build_target_directory }} INPUT_CMAKE_VERSION: ${{ inputs.cmake_version }} ================================================ FILE: .github/workflows/cxx_interop.yml ================================================ name: Cxx interop permissions: contents: read on: workflow_call: inputs: linux_5_9_enabled: type: boolean description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to false." default: false linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to false." default: false linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." default: true linux_6_1_enabled: type: boolean description: "Boolean to enable the Linux 6.1 Swift version matrix job. Defaults to true." default: true linux_6_2_enabled: type: boolean description: "Boolean to enable the Linux 6.2 Swift version matrix job. Defaults to true." default: true linux_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: false linux_nightly_6_1_enabled: type: boolean description: "⚠️ Deprecated, use linux_nightly_next_enabled." default: true linux_nightly_next_enabled: type: boolean description: "Boolean to enable the Linux matrix job using the nightly build for the next Swift version. Defaults to true." default: true linux_nightly_main_enabled: type: boolean description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." default: true windows_6_0_enabled: type: boolean description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false windows_6_1_enabled: type: boolean description: "Boolean to enable the Windows 6.1 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false windows_6_2_enabled: type: boolean description: "Boolean to enable the Windows 6.2 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false windows_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." # TODO: implement Windows Cxx compat checking default: false windows_nightly_main_enabled: type: boolean description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking default: false linux_env_vars: type: string description: "Environment variables for Linux jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" windows_env_vars: type: string description: "Environment variables for Windows jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" minimum_swift_version: type: string description: "Minimum Swift version to include in the matrix. Leave empty for auto-detection from Package.swift, specify a version like '6.0' to override, or set to 'none' to disable filtering." default: "" jobs: construct-matrix: name: Construct Cxx interop matrix runs-on: ubuntu-latest outputs: cxx-interop-matrix: '${{ steps.generate-matrix.outputs.cxx-interop-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate JSON environment variables linux_env_vars_json="$INPUT_LINUX_ENV_VARS" windows_env_vars_json="$INPUT_WINDOWS_ENV_VARS" if ! echo "$linux_env_vars_json" | jq empty 2>/dev/null; then echo "Error: linux_env_vars is not valid JSON" exit 1 fi if ! echo "$windows_env_vars_json" | jq empty 2>/dev/null; then echo "Error: windows_env_vars is not valid JSON" exit 1 fi echo "cxx-interop-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | MATRIX_LINUX_ENV_VARS_JSON="${linux_env_vars_json}" MATRIX_WINDOWS_ENV_VARS_JSON="${windows_env_vars_json}" bash)" >> "$GITHUB_OUTPUT" env: INPUT_LINUX_ENV_VARS: ${{ inputs.linux_env_vars }} INPUT_WINDOWS_ENV_VARS: ${{ inputs.windows_env_vars }} MATRIX_LINUX_COMMAND: "curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash" MATRIX_LINUX_SETUP_COMMAND: "swift --version && apt-get update -y -q && apt-get install -y -q curl jq" MATRIX_MIN_SWIFT_VERSION: ${{ inputs.minimum_swift_version }} MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }} MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }} MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }} MATRIX_LINUX_6_1_ENABLED: ${{ inputs.linux_6_1_enabled }} MATRIX_LINUX_6_2_ENABLED: ${{ inputs.linux_6_2_enabled }} MATRIX_LINUX_NIGHTLY_NEXT_ENABLED: ${{ inputs.linux_nightly_6_1_enabled && inputs.linux_nightly_next_enabled }} MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }} cxx-interop: name: Cxx interop needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Cxx interop" matrix_string: '${{ needs.construct-matrix.outputs.cxx-interop-matrix }}' ================================================ FILE: .github/workflows/macos_benchmarks.yml ================================================ name: macOS benchmarks permissions: contents: read on: workflow_call: inputs: benchmark_package_path: type: string description: "Path to the directory containing the benchmarking package. Defaults to ." default: "." swift_package_arguments: type: string description: "Arguments to the switch package command invocation e.g. `--disable-sandbox`" macos_xcode_16_3_enabled: type: boolean description: "Boolean to enable the macOS Xcode 16.3 benchmark job. Defaults to false." default: false macos_xcode_16_4_enabled: type: boolean description: "Boolean to enable the macOS Xcode 16.4 benchmark job. Defaults to false." default: false macos_xcode_26_0_enabled: type: boolean description: "Boolean to enable the macOS Xcode 26.0 benchmark job. Defaults to false." default: false macos_xcode_26_1_enabled: type: boolean description: "Boolean to enable the macOS Xcode 26.1 benchmark job. Defaults to false." default: false macos_xcode_26_2_enabled: type: boolean description: "Boolean to enable the macOS Xcode 26.2 benchmark job. Defaults to false." default: false macos_xcode_latest_beta_enabled: type: boolean description: "Boolean to enable the macOS Xcode latest beta benchmark job. Defaults to false." default: false macos_swift_6_1_enabled: type: boolean description: "Boolean to enable the macOS Swift 6.1 benchmark job. Defaults to false." default: false macos_swift_6_2_enabled: type: boolean description: "Boolean to enable the macOS Swift 6.2 benchmark job. Defaults to false." default: false macos_swift_6_3_enabled: type: boolean description: "Boolean to enable the macOS Swift 6.3 benchmark job. Defaults to false." default: false macos_runner_pool: type: string description: "The runner pool which will be requested for macOS jobs." default: "nightly" macos_env_vars: type: string description: "Environment variables for macOS jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" minimum_swift_version: type: string description: "Minimum Swift version to include in the matrix. Leave empty for auto-detection from Package.swift, specify a version like '6.0' to override, or set to 'none' to disable filtering." default: "" jobs: construct-matrix-macos: name: Construct macOS Benchmarks matrix runs-on: ubuntu-latest if: | inputs.macos_xcode_16_3_enabled || inputs.macos_xcode_16_4_enabled || inputs.macos_xcode_26_0_enabled || inputs.macos_xcode_26_1_enabled || inputs.macos_xcode_26_2_enabled || inputs.macos_xcode_latest_beta_enabled || inputs.macos_swift_6_1_enabled || inputs.macos_swift_6_2_enabled || inputs.macos_swift_6_3_enabled outputs: macos-matrix: '${{ steps.generate-matrix.outputs.macos-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate JSON environment variables macos_env_vars_json="$INPUT_MACOS_ENV_VARS" if ! echo "$macos_env_vars_json" | jq empty 2>/dev/null; then echo "Error: macos_env_vars is not valid JSON" exit 1 fi runner_pool="${MACOS_RUNNER_POOL}" xcode_16_3_enabled="${MACOS_XCODE_16_3_ENABLED}" xcode_16_4_enabled="${MACOS_XCODE_16_4_ENABLED}" xcode_26_0_enabled="${MACOS_XCODE_26_0_ENABLED}" xcode_26_1_enabled="${MACOS_XCODE_26_1_ENABLED}" xcode_26_2_enabled="${MACOS_XCODE_26_2_ENABLED}" xcode_latest_beta_enabled="${MACOS_XCODE_LATEST_BETA_ENABLED}" swift_6_1_enabled="${MACOS_SWIFT_6_1_ENABLED}" swift_6_2_enabled="${MACOS_SWIFT_6_2_ENABLED}" swift_6_3_enabled="${MACOS_SWIFT_6_3_ENABLED}" # Create matrix from inputs matrix='{"config": []}' if [[ "$xcode_16_3_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Xcode 16.3)", "xcode_version": "16.3", "xcode_app": "Xcode_16.3.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_16_4_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Xcode 16.4)", "xcode_version": "16.4", "xcode_app": "Xcode_16.4.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_26_0_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Xcode 26.0)", "xcode_version": "26.0", "xcode_app": "Xcode_26.0.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_26_1_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Xcode 26.1)", "xcode_version": "26.1", "xcode_app": "Xcode_26.1.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_26_2_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Xcode 26.2)", "xcode_version": "26.2", "xcode_app": "Xcode_26.2.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_latest_beta_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Xcode latest beta)", "xcode_version": "latest beta", "xcode_app": "Xcode-latest.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$swift_6_1_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Swift 6.1)", "xcode_version": "swift 6.1", "xcode_app": "Xcode_swift_6.1.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$swift_6_2_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Swift 6.2)", "xcode_version": "swift 6.2", "xcode_app": "Xcode_swift_6.2.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$swift_6_3_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$macos_env_vars_json" \ '.config[.config| length] |= . + { "name": "macOS (Swift 6.3)", "xcode_version": "swift 6.3", "xcode_app": "Xcode_swift_6.3.app", "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi echo "macos-matrix=$matrix" >> "$GITHUB_OUTPUT" env: INPUT_MACOS_ENV_VARS: ${{ inputs.macos_env_vars }} MACOS_RUNNER_POOL: ${{ inputs.macos_runner_pool }} MACOS_XCODE_16_3_ENABLED: ${{ inputs.macos_xcode_16_3_enabled }} MACOS_XCODE_16_4_ENABLED: ${{ inputs.macos_xcode_16_4_enabled }} MACOS_XCODE_26_0_ENABLED: ${{ inputs.macos_xcode_26_0_enabled }} MACOS_XCODE_26_1_ENABLED: ${{ inputs.macos_xcode_26_1_enabled }} MACOS_XCODE_26_2_ENABLED: ${{ inputs.macos_xcode_26_2_enabled }} MACOS_XCODE_LATEST_BETA_ENABLED: ${{ inputs.macos_xcode_latest_beta_enabled }} MACOS_SWIFT_6_1_ENABLED: ${{ inputs.macos_swift_6_1_enabled }} MACOS_SWIFT_6_2_ENABLED: ${{ inputs.macos_swift_6_2_enabled }} MACOS_SWIFT_6_3_ENABLED: ${{ inputs.macos_swift_6_3_enabled }} benchmarks-macos: name: ${{ matrix.config.name }} needs: construct-matrix-macos runs-on: [self-hosted, macos, "${{ matrix.config.os }}", "${{ matrix.config.arch }}", "${{ matrix.config.pool }}"] timeout-minutes: 30 strategy: fail-fast: false matrix: ${{ fromJson(needs.construct-matrix-macos.outputs.macos-matrix) }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Install jemalloc run: | brew install jemalloc - name: Export environment variables if: ${{ matrix.config.env != '' && matrix.config.env != '{}'}} run: | echo "Exporting environment variables from matrix configuration..." echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> $GITHUB_ENV echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "exporting \(.key)=\(.value)"' env: MATRIX_ENV_JSON: ${{ toJSON(matrix.config.env) }} - name: Run benchmarks script run: | curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check_benchmark_thresholds.sh | BENCHMARK_PACKAGE_PATH="$INPUT_BENCHMARK_PACKAGE_PATH" bash -s -- --disable-sandbox --allow-writing-to-package-directory env: INPUT_BENCHMARK_PACKAGE_PATH: ${{ inputs.benchmark_package_path }} DEVELOPER_DIR: "/Applications/${{ matrix.config.xcode_app }}" SWIFT_VERSION: "Xcode ${{ matrix.config.xcode_version }}" ================================================ FILE: .github/workflows/macos_tests.yml ================================================ name: macOS tests permissions: contents: read on: workflow_call: inputs: xcode_15_4_enabled: type: boolean description: "⚠️ Jobs with this version of Xcode are deprecated." default: false xcode_15_4_test_arguments_override: type: string description: "⚠️ Deprecated." default: "" xcode_16_0_enabled: type: boolean description: "⚠️ Jobs with this version of Xcode are deprecated." default: false xcode_16_0_build_arguments_override: type: string description: "The arguments passed to swift build in the macOS 5.10 Swift version matrix job." default: "" xcode_16_0_test_arguments_override: type: string description: "The arguments passed to swift test in the macOS 5.10 Swift version matrix job." default: "" xcode_16_0_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_16_1_enabled: type: boolean description: "⚠️ Jobs with this version of Xcode are deprecated." default: false xcode_16_1_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 16.1 job." default: "" xcode_16_1_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 16.1 job." default: "" xcode_16_1_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_16_2_enabled: type: boolean description: "⚠️ Jobs with this version of Xcode are deprecated." default: false xcode_16_2_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 16.2 job." default: "" xcode_16_2_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 16.2 job." default: "" xcode_16_2_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_16_3_enabled: type: boolean description: "Boolean to enable the Xcode version 16.3 jobs. Defaults to true." default: true xcode_16_3_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 16.3 job." default: "" xcode_16_3_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 16.3 job." default: "" xcode_16_3_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_16_4_enabled: type: boolean description: "Boolean to enable the Xcode version 16.4 jobs. Defaults to true." default: true xcode_16_4_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 16.4 job." default: "" xcode_16_4_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 16.4 job." default: "" xcode_16_4_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_26_0_enabled: type: boolean description: "Boolean to enable the Xcode version 26.0 jobs. Defaults to true." default: true xcode_26_0_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 26.0 job." default: "" xcode_26_0_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 26.0 job." default: "" xcode_26_0_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_26_1_enabled: type: boolean description: "Boolean to enable the Xcode version 26.1 jobs. Defaults to true." default: true xcode_26_1_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 26.1 job." default: "" xcode_26_1_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 26.1 job." default: "" xcode_26_1_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_26_2_enabled: type: boolean description: "Boolean to enable the Xcode version 26.2 jobs. Defaults to true." default: true xcode_26_2_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode version 26.2 job." default: "" xcode_26_2_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode version 26.2 job." default: "" xcode_26_2_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" xcode_26_beta_enabled: type: boolean description: "⚠️ Deprecated." default: false xcode_26_beta_1_build_arguments_override: type: string description: "⚠️ Deprecated." default: "" xcode_26_beta_1_test_arguments_override: type: string description: "⚠️ Deprecated." default: "" xcode_26_beta_1_setup_command: type: string description: "⚠️ Deprecated." default: "" xcode_latest_beta_enabled: type: boolean description: "Boolean to enable the Xcode beta jobs (uses latest beta if one currently exists). Defaults to true." default: false xcode_latest_beta_build_arguments_override: type: string description: "The arguments passed to swift build in the Xcode beta job." default: "" xcode_latest_beta_test_arguments_override: type: string description: "The arguments passed to swift test in the Xcode beta job." default: "" xcode_latest_beta_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" swift_6_1_enabled: type: boolean description: "Boolean to enable the Swift 6.1 jobs. Defaults to false." default: false swift_6_1_build_arguments_override: type: string description: "The arguments passed to swift build in the Swift 6.1 job." default: "" swift_6_1_test_arguments_override: type: string description: "The arguments passed to swift test in the Swift 6.1 job." default: "" swift_6_1_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" swift_6_2_enabled: type: boolean description: "Boolean to enable the Swift 6.2 jobs. Defaults to false." default: false swift_6_2_build_arguments_override: type: string description: "The arguments passed to swift build in the Swift 6.2 job." default: "" swift_6_2_test_arguments_override: type: string description: "The arguments passed to swift test in the Swift 6.2 job." default: "" swift_6_2_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" swift_6_3_enabled: type: boolean description: "Boolean to enable the Swift 6.3 jobs. Defaults to false." default: false swift_6_3_build_arguments_override: type: string description: "The arguments passed to swift build in the Swift 6.3 job." default: "" swift_6_3_test_arguments_override: type: string description: "The arguments passed to swift test in the Swift 6.3 job." default: "" swift_6_3_setup_command: type: string description: "The command(s) to be executed before all other work." default: "" build_scheme: type: string description: "The build scheme used in the Xcode builds." swift_test_enabled: type: boolean description: "Boolean to enable test execution with `swift test`. Defaults to true." default: true macos_xcode_build_enabled: type: boolean description: "Boolean to enable the Xcode build targeting macOS. Defaults to true." default: true macos_xcode_test_enabled: type: boolean description: "Boolean to enable the Xcode test targeting macOS. Defaults to false." default: false ios_xcode_build_enabled: type: boolean description: "Boolean to enable the Xcode build targeting iOS. Defaults to true." default: true ios_xcode_test_enabled: type: boolean description: "Boolean to enable the Xcode test targeting iOS. Defaults to false." default: false watchos_xcode_build_enabled: type: boolean description: "Boolean to enable the Xcode build targeting watchOS. Defaults to true." default: true watchos_xcode_test_enabled: type: boolean description: "Boolean to enable the Xcode test targeting watchOS. Defaults to false." default: false tvos_xcode_build_enabled: type: boolean description: "Boolean to enable the Xcode build targeting tvOS. Defaults to true." default: true tvos_xcode_test_enabled: type: boolean description: "Boolean to enable the Xcode test targeting tvOS. Defaults to false." default: false visionos_xcode_build_enabled: type: boolean description: "Boolean to enable the Xcode build targeting visionOS. Defaults to true." default: true visionos_xcode_test_enabled: type: boolean description: "Boolean to enable the Xcode test targeting visionOS. Defaults to false." default: false runner_pool: type: string description: "The runner pool which will be requested." default: "nightly" debug_output_enabled: type: boolean description: "Boolean to enable debug output from xcodebuild by eliding -quiet. Defaults to false." default: false env_vars: type: string description: "Environment variables for jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" jobs: construct-matrix: name: Construct Darwin matrix runs-on: ubuntu-latest outputs: darwin-matrix: '${{ steps.generate-matrix.outputs.darwin-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate and use JSON environment variables directly env_vars_json="$INPUT_ENV_VARS" # Validate JSON format if ! echo "$env_vars_json" | jq empty 2>/dev/null; then echo "Error: env_vars is not valid JSON" exit 1 fi cat >> "$GITHUB_OUTPUT" << EOM darwin-matrix=$( runner_pool="${MATRIX_RUNNER_POOL:="nightly"}" xcode_15_4_enabled="${MATRIX_MACOS_15_4_ENABLED:=true}" xcode_15_4_build_arguments_override="${MATRIX_MACOS_15_4_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_15_4_test_arguments_override="${MATRIX_MACOS_15_4_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_15_4_setup_command="${MATRIX_MACOS_15_4_SETUP_COMMAND:=""}" xcode_16_0_enabled="${MATRIX_MACOS_16_0_ENABLED:=true}" xcode_16_0_build_arguments_override="${MATRIX_MACOS_16_0_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_16_0_test_arguments_override="${MATRIX_MACOS_16_0_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_16_0_setup_command="${MATRIX_MACOS_16_0_SETUP_COMMAND:=""}" xcode_16_1_enabled="${MATRIX_MACOS_16_1_ENABLED:=true}" xcode_16_1_build_arguments_override="${MATRIX_MACOS_16_1_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_16_1_test_arguments_override="${MATRIX_MACOS_16_1_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_16_1_setup_command="${MATRIX_MACOS_16_1_SETUP_COMMAND:=""}" xcode_16_2_enabled="${MATRIX_MACOS_16_2_ENABLED:=true}" xcode_16_2_build_arguments_override="${MATRIX_MACOS_16_2_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_16_2_test_arguments_override="${MATRIX_MACOS_16_2_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_16_2_setup_command="${MATRIX_MACOS_16_2_SETUP_COMMAND:=""}" xcode_16_3_enabled="${MATRIX_MACOS_16_3_ENABLED:=true}" xcode_16_3_build_arguments_override="${MATRIX_MACOS_16_3_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_16_3_test_arguments_override="${MATRIX_MACOS_16_3_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_16_3_setup_command="${MATRIX_MACOS_16_3_SETUP_COMMAND:=""}" xcode_16_4_enabled="${MATRIX_MACOS_16_4_ENABLED:=true}" xcode_16_4_build_arguments_override="${MATRIX_MACOS_16_4_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_16_4_test_arguments_override="${MATRIX_MACOS_16_4_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_16_4_setup_command="${MATRIX_MACOS_16_4_SETUP_COMMAND:=""}" xcode_26_0_enabled="${MATRIX_MACOS_26_0_ENABLED:=true}" xcode_26_0_build_arguments_override="${MATRIX_MACOS_26_0_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_26_0_test_arguments_override="${MATRIX_MACOS_26_0_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_26_0_setup_command="${MATRIX_MACOS_26_0_SETUP_COMMAND:=""}" xcode_26_1_enabled="${MATRIX_MACOS_26_1_ENABLED:=true}" xcode_26_1_build_arguments_override="${MATRIX_MACOS_26_1_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_26_1_test_arguments_override="${MATRIX_MACOS_26_1_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_26_1_setup_command="${MATRIX_MACOS_26_1_SETUP_COMMAND:=""}" xcode_26_2_enabled="${MATRIX_MACOS_26_2_ENABLED:=true}" xcode_26_2_build_arguments_override="${MATRIX_MACOS_26_2_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_26_2_test_arguments_override="${MATRIX_MACOS_26_2_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_26_2_setup_command="${MATRIX_MACOS_26_2_SETUP_COMMAND:=""}" xcode_latest_beta_enabled="${MATRIX_MACOS_26_BETA_1_ENABLED:=true}" # TODO: remove once no repos use this xcode_latest_beta_build_arguments_override="${MATRIX_MACOS_26_BETA_1_BUILD_ARGUMENTS_OVERRIDE:=""}" # TODO: remove once no repos use this xcode_latest_beta_test_arguments_override="${MATRIX_MACOS_26_BETA_1_TEST_ARGUMENTS_OVERRIDE:=""}" # TODO: remove once no repos use this xcode_latest_beta_setup_command="${MATRIX_MACOS_26_BETA_1_SETUP_COMMAND:=""}" # TODO: remove once no repos use this xcode_latest_beta_enabled="${MATRIX_MACOS_LATEST_BETA_ENABLED:=true}" xcode_latest_beta_build_arguments_override="${MATRIX_MACOS_LATEST_BETA_BUILD_ARGUMENTS_OVERRIDE:=""}" xcode_latest_beta_test_arguments_override="${MATRIX_MACOS_LATEST_BETA_TEST_ARGUMENTS_OVERRIDE:=""}" xcode_latest_beta_setup_command="${MATRIX_MACOS_LATEST_BETA_SETUP_COMMAND:=""}" swift_6_1_enabled="${MATRIX_SWIFT_6_1_ENABLED:=true}" swift_6_1_build_arguments_override="${MATRIX_SWIFT_6_1_BUILD_ARGUMENTS_OVERRIDE:=""}" swift_6_1_test_arguments_override="${MATRIX_SWIFT_6_1_TEST_ARGUMENTS_OVERRIDE:=""}" swift_6_1_setup_command="${MATRIX_SWIFT_6_1_SETUP_COMMAND:=""}" swift_6_2_enabled="${MATRIX_SWIFT_6_2_ENABLED:=true}" swift_6_2_build_arguments_override="${MATRIX_SWIFT_6_2_BUILD_ARGUMENTS_OVERRIDE:=""}" swift_6_2_test_arguments_override="${MATRIX_SWIFT_6_2_TEST_ARGUMENTS_OVERRIDE:=""}" swift_6_2_setup_command="${MATRIX_SWIFT_6_2_SETUP_COMMAND:=""}" swift_6_3_enabled="${MATRIX_SWIFT_6_3_ENABLED:=true}" swift_6_3_build_arguments_override="${MATRIX_SWIFT_6_3_BUILD_ARGUMENTS_OVERRIDE:=""}" swift_6_3_test_arguments_override="${MATRIX_SWIFT_6_3_TEST_ARGUMENTS_OVERRIDE:=""}" swift_6_3_setup_command="${MATRIX_SWIFT_6_3_SETUP_COMMAND:=""}" # Create matrix from inputs matrix='{"config": []}' if [[ "$xcode_15_4_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_15_4_setup_command" \ --arg build_arguments_override "$xcode_15_4_build_arguments_override" \ --arg test_arguments_override "$xcode_15_4_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 15.4", "xcode_version": "15.4", "xcode_app": "Xcode_15.4.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_16_0_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_16_0_setup_command" \ --arg build_arguments_override "$xcode_16_0_build_arguments_override" \ --arg test_arguments_override "$xcode_16_0_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 16.0", "xcode_version": "16.0", "xcode_app": "Xcode_16.0.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_16_1_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_16_1_setup_command" \ --arg build_arguments_override "$xcode_16_1_build_arguments_override" \ --arg test_arguments_override "$xcode_16_1_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 16.1", "xcode_version": "16.1", "xcode_app": "Xcode_16.1.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_16_2_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_16_2_setup_command" \ --arg build_arguments_override "$xcode_16_2_build_arguments_override" \ --arg test_arguments_override "$xcode_16_2_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 16.2", "xcode_version": "16.2", "xcode_app": "Xcode_16.2.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_16_3_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_16_3_setup_command" \ --arg build_arguments_override "$xcode_16_3_build_arguments_override" \ --arg test_arguments_override "$xcode_16_3_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 16.3", "xcode_version": "16.3", "xcode_app": "Xcode_16.3.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_16_4_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_16_4_setup_command" \ --arg build_arguments_override "$xcode_16_4_build_arguments_override" \ --arg test_arguments_override "$xcode_16_4_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 16.4", "xcode_version": "16.4", "xcode_app": "Xcode_16.4.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_26_0_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_26_0_setup_command" \ --arg build_arguments_override "$xcode_26_0_build_arguments_override" \ --arg test_arguments_override "$xcode_26_0_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 26.0", "xcode_version": "26.0", "xcode_app": "Xcode_26.0.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_26_1_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_26_1_setup_command" \ --arg build_arguments_override "$xcode_26_1_build_arguments_override" \ --arg test_arguments_override "$xcode_26_1_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 26.1", "xcode_version": "26.1", "xcode_app": "Xcode_26.1.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_26_2_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_26_2_setup_command" \ --arg build_arguments_override "$xcode_26_2_build_arguments_override" \ --arg test_arguments_override "$xcode_26_2_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode 26.2", "xcode_version": "26.2", "xcode_app": "Xcode_26.2.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$xcode_latest_beta_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$xcode_latest_beta_setup_command" \ --arg build_arguments_override "$xcode_latest_beta_build_arguments_override" \ --arg test_arguments_override "$xcode_latest_beta_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Xcode latest beta", "xcode_version": "latest beta", "xcode_app": "Xcode-latest.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$swift_6_1_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$swift_6_1_setup_command" \ --arg build_arguments_override "$swift_6_1_build_arguments_override" \ --arg test_arguments_override "$swift_6_1_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Swift 6.1", "xcode_version": "swift 6.1", "xcode_app": "Xcode_swift_6.1.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$swift_6_2_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$swift_6_2_setup_command" \ --arg build_arguments_override "$swift_6_2_build_arguments_override" \ --arg test_arguments_override "$swift_6_2_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Swift 6.2", "xcode_version": "swift 6.2", "xcode_app": "Xcode_swift_6.2.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi if [[ "$swift_6_3_enabled" == "true" ]]; then matrix=$(echo "$matrix" | jq -c \ --arg setup_command "$swift_6_3_setup_command" \ --arg build_arguments_override "$swift_6_3_build_arguments_override" \ --arg test_arguments_override "$swift_6_3_test_arguments_override" \ --arg runner_pool "$runner_pool" \ --argjson env_vars "$env_vars_json" \ '.config[.config| length] |= . + { "name": "Swift 6.3", "xcode_version": "swift 6.3", "xcode_app": "Xcode_swift_6.3.app", "setup_command": $setup_command, "build_arguments_override": $build_arguments_override, "test_arguments_override": $test_arguments_override, "os": "tahoe", "arch": "ARM64", "pool": $runner_pool, "env": $env_vars }') fi echo "$matrix" | jq -c )" EOM env: INPUT_ENV_VARS: ${{ inputs.env_vars }} MATRIX_RUNNER_POOL: ${{ inputs.runner_pool }} MATRIX_MACOS_15_4_ENABLED: ${{ inputs.xcode_15_4_enabled }} MATRIX_MACOS_15_4_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_15_4_build_arguments_override }} MATRIX_MACOS_15_4_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_15_4_test_arguments_override }} MATRIX_MACOS_15_4_SETUP_COMMAND: ${{ inputs.xcode_15_4_setup_command }} MATRIX_MACOS_16_0_ENABLED: ${{ inputs.xcode_16_0_enabled }} MATRIX_MACOS_16_0_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_0_build_arguments_override }} MATRIX_MACOS_16_0_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_0_test_arguments_override }} MATRIX_MACOS_16_0_SETUP_COMMAND: ${{ inputs.xcode_16_0_setup_command }} MATRIX_MACOS_16_1_ENABLED: ${{ inputs.xcode_16_1_enabled }} MATRIX_MACOS_16_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_1_build_arguments_override }} MATRIX_MACOS_16_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_1_test_arguments_override }} MATRIX_MACOS_16_1_SETUP_COMMAND: ${{ inputs.xcode_16_1_setup_command }} MATRIX_MACOS_16_2_ENABLED: ${{ inputs.xcode_16_2_enabled }} MATRIX_MACOS_16_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_2_build_arguments_override }} MATRIX_MACOS_16_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_2_test_arguments_override }} MATRIX_MACOS_16_2_SETUP_COMMAND: ${{ inputs.xcode_16_2_setup_command }} MATRIX_MACOS_16_3_ENABLED: ${{ inputs.xcode_16_3_enabled }} MATRIX_MACOS_16_3_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_3_build_arguments_override }} MATRIX_MACOS_16_3_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_3_test_arguments_override }} MATRIX_MACOS_16_3_SETUP_COMMAND: ${{ inputs.xcode_16_3_setup_command }} MATRIX_MACOS_16_4_ENABLED: ${{ inputs.xcode_16_4_enabled }} MATRIX_MACOS_16_4_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_4_build_arguments_override }} MATRIX_MACOS_16_4_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_16_4_test_arguments_override }} MATRIX_MACOS_16_4_SETUP_COMMAND: ${{ inputs.xcode_16_4_setup_command }} MATRIX_MACOS_26_0_ENABLED: ${{ inputs.xcode_26_0_enabled }} MATRIX_MACOS_26_0_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_0_build_arguments_override }} MATRIX_MACOS_26_0_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_0_test_arguments_override }} MATRIX_MACOS_26_0_SETUP_COMMAND: ${{ inputs.xcode_26_0_setup_command }} MATRIX_MACOS_26_1_ENABLED: ${{ inputs.xcode_26_1_enabled }} MATRIX_MACOS_26_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_1_build_arguments_override }} MATRIX_MACOS_26_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_1_test_arguments_override }} MATRIX_MACOS_26_1_SETUP_COMMAND: ${{ inputs.xcode_26_1_setup_command }} MATRIX_MACOS_26_2_ENABLED: ${{ inputs.xcode_26_2_enabled }} MATRIX_MACOS_26_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_2_build_arguments_override }} MATRIX_MACOS_26_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_2_test_arguments_override }} MATRIX_MACOS_26_2_SETUP_COMMAND: ${{ inputs.xcode_26_2_setup_command }} MATRIX_MACOS_26_BETA_1_ENABLED: ${{ inputs.xcode_26_beta_1_enabled }} MATRIX_MACOS_26_BETA_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_beta_1_build_arguments_override }} MATRIX_MACOS_26_BETA_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_26_beta_1_test_arguments_override }} MATRIX_MACOS_26_BETA_1_SETUP_COMMAND: ${{ inputs.xcode_26_beta_1_setup_command }} MATRIX_MACOS_LATEST_BETA_ENABLED: ${{ inputs.xcode_latest_beta_enabled }} MATRIX_MACOS_LATEST_BETA_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_latest_beta_build_arguments_override }} MATRIX_MACOS_LATEST_BETA_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.xcode_latest_beta_test_arguments_override }} MATRIX_MACOS_LATEST_BETA_SETUP_COMMAND: ${{ inputs.xcode_latest_beta_setup_command }} MATRIX_SWIFT_6_1_ENABLED: ${{ inputs.swift_6_1_enabled }} MATRIX_SWIFT_6_1_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_1_build_arguments_override }} MATRIX_SWIFT_6_1_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_1_test_arguments_override }} MATRIX_SWIFT_6_1_SETUP_COMMAND: ${{ inputs.swift_6_1_setup_command }} MATRIX_SWIFT_6_2_ENABLED: ${{ inputs.swift_6_2_enabled }} MATRIX_SWIFT_6_2_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_2_build_arguments_override }} MATRIX_SWIFT_6_2_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_2_test_arguments_override }} MATRIX_SWIFT_6_2_SETUP_COMMAND: ${{ inputs.swift_6_2_setup_command }} MATRIX_SWIFT_6_3_ENABLED: ${{ inputs.swift_6_3_enabled }} MATRIX_SWIFT_6_3_BUILD_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_3_build_arguments_override }} MATRIX_SWIFT_6_3_TEST_ARGUMENTS_OVERRIDE: ${{ inputs.swift_6_3_test_arguments_override }} MATRIX_SWIFT_6_3_SETUP_COMMAND: ${{ inputs.swift_6_3_setup_command }} darwin-job: name: ${{ matrix.config.name }} needs: construct-matrix if: github.repository_owner == 'apple' runs-on: [self-hosted, macos, "${{ matrix.config.os }}", "${{ matrix.config.arch }}", "${{ matrix.config.pool }}"] timeout-minutes: 60 strategy: fail-fast: false matrix: ${{ fromJson(needs.construct-matrix.outputs.darwin-matrix) }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Export environment variables if: ${{ matrix.config.env != '' && matrix.config.env != '{}'}} run: | echo "Exporting environment variables from matrix configuration..." echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> $GITHUB_ENV echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "exporting \(.key)=\(.value)"' env: MATRIX_ENV_JSON: ${{ toJSON(matrix.config.env) }} - name: Emit diagnostics run: | swift --version /usr/bin/xcodebuild -version - name: Setup command if: ${{ matrix.config.setup_command != '' }} run: bash -c "$MATRIX_SETUP_COMMAND" env: MATRIX_SETUP_COMMAND: ${{ matrix.config.setup_command }} - name: Swift build run: | if [ -n "$MATRIX_BUILD_ARGUMENTS_OVERRIDE" ]; then swift build $MATRIX_BUILD_ARGUMENTS_OVERRIDE else swift build --build-tests fi env: MATRIX_BUILD_ARGUMENTS_OVERRIDE: ${{ matrix.config.build_arguments_override }} - name: Swift test if: 'inputs.swift_test_enabled' run: | if [ -n "$MATRIX_TEST_ARGUMENTS_OVERRIDE" ]; then swift test $MATRIX_TEST_ARGUMENTS_OVERRIDE else swift test fi env: MATRIX_TEST_ARGUMENTS_OVERRIDE: ${{ matrix.config.test_arguments_override }} # see `xcodebuild -list` for schemes, `simctl list` for destinations - name: macOS build if: '!cancelled() && inputs.macos_xcode_build_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=macos,variant=macos" build - name: macOS test if: '!cancelled() && inputs.macos_xcode_test_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=My Mac,variant=macos" test - name: macOS Catalyst build if: '!cancelled() && inputs.macos_xcode_build_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=macos,variant=Mac Catalyst" build - name: macOS Catalyst test if: '!cancelled() && inputs.macos_xcode_test_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=My Mac,variant=Mac Catalyst" test - name: iOS build if: '!cancelled() && inputs.ios_xcode_build_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=ios" build - name: iOS test if: '!cancelled() && inputs.ios_xcode_test_enabled' run: | /usr/bin/xcrun simctl shutdown all /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=iPhone Air" test - name: watchOS build if: '!cancelled() && inputs.watchos_xcode_build_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=watchos" build - name: watchOS test if: '!cancelled() && inputs.watchos_xcode_test_enabled' run: | /usr/bin/xcrun simctl shutdown all /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=Apple Watch Ultra 3 (49mm)" test - name: tvOS build if: '!cancelled() && inputs.tvos_xcode_build_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=tvos" build - name: tvOS test if: '!cancelled() && inputs.tvos_xcode_test_enabled' run: | /usr/bin/xcrun simctl shutdown all /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=Apple TV 4K (3rd generation)" test - name: visionOS build # arm only if: '!cancelled() && inputs.visionos_xcode_build_enabled' run: /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "generic/platform=visionos" build - name: visionOS test # arm only if: '!cancelled() && inputs.visionos_xcode_test_enabled' run: | /usr/bin/xcrun simctl shutdown all /usr/bin/xcodebuild ${QUIET_ARG} -scheme ${BUILD_SCHEME} -destination "name=Apple Vision Pro" test env: XCODE_VERSION: ${{ matrix.config.xcode_version }} DEVELOPER_DIR: "/Applications/${{ matrix.config.xcode_app }}" BUILD_SCHEME: ${{ inputs.build_scheme }} QUIET_ARG: ${{ inputs.debug_output_enabled && ' ' || '-quiet' }} ================================================ FILE: .github/workflows/main.yml ================================================ name: Main permissions: contents: read on: push: branches: [main] schedule: - cron: "0 8,20 * * *" jobs: unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_nightly_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" cxx-interop: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main benchmarks: name: Benchmarks # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/benchmarks.yml@main with: benchmark_package_path: "Benchmarks" construct-integration-test-matrix: name: Construct integration test matrix runs-on: ubuntu-latest outputs: integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: echo "integration-test-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT" env: MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" MATRIX_LINUX_ENV_VARS_JSON: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}' integration-tests: name: Integration tests needs: construct-integration-test-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Integration tests" matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}' static-sdk: name: Static Linux Swift SDK # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/static_sdk.yml@main wasm-sdk: name: WebAssembly Swift SDK # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/wasm_swift_sdk.yml@main with: additional_command_arguments: "--target NIOCore" android-sdk: name: Android Swift SDK # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/android_swift_sdk.yml@main macos-tests: name: macOS tests # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/macos_tests.yml@main with: runner_pool: nightly build_scheme: swift-nio-Package debug_output_enabled: true xcode_16_3_enabled: false xcode_16_4_enabled: false xcode_26_0_enabled: false xcode_26_1_enabled: false xcode_26_2_enabled: false swift_6_1_enabled: true swift_6_2_enabled: true swift_6_3_enabled: true macos_xcode_test_enabled: false # Disabled because of an issue ios_xcode_test_enabled: true watchos_xcode_test_enabled: true tvos_xcode_test_enabled: true visionos_xcode_test_enabled: true release-builds: name: Release builds uses: apple/swift-nio/.github/workflows/release_builds.yml@main ================================================ FILE: .github/workflows/pull_request.yml ================================================ name: PR permissions: contents: read on: pull_request: types: [opened, reopened, synchronize] jobs: soundness: name: Soundness uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.7 with: license_header_check_project_name: "SwiftNIO" # Workaround https://github.com/swiftlang/swift-docc/issues/1280 docs_check_container_image: "swift:6.1-noble" unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_nightly_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" benchmarks: name: Benchmarks # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/benchmarks.yml@main with: benchmark_package_path: "Benchmarks" cxx-interop: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main construct-integration-test-matrix: name: Construct integration test matrix runs-on: ubuntu-latest outputs: integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: echo "integration-test-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT" env: MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq" MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh" MATRIX_LINUX_ENV_VARS_JSON: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}' integration-tests: name: Integration tests needs: construct-integration-test-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Integration tests" matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}' vsock-tests: name: Vsock tests runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Load vsock_loopback kernel module run: sudo modprobe vsock_loopback - name: Build package tests run: swift build --build-tests - name: Run Vsock tests shell: bash # explicitly choose bash, which ensures -o pipefail run: swift test --filter "(?i)vsock" | tee test.out - name: Check for skipped tests run: test -r test.out && ! grep -i skipped test.out macos-tests: name: macOS tests # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/macos_tests.yml@main with: runner_pool: general build_scheme: swift-nio-Package xcode_16_3_enabled: false xcode_16_4_enabled: false xcode_26_0_enabled: false xcode_26_1_enabled: false xcode_26_2_enabled: false swift_6_1_enabled: true swift_6_2_enabled: true swift_6_3_enabled: true static-sdk: name: Static Linux Swift SDK # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/static_sdk.yml@main wasm-sdk: name: WebAssembly Swift SDK # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/wasm_swift_sdk.yml@main with: additional_command_arguments: "--target NIOCore" android-sdk: name: Android Swift SDK # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/android_swift_sdk.yml@main release-builds: name: Release builds uses: apple/swift-nio/.github/workflows/release_builds.yml@main ================================================ FILE: .github/workflows/pull_request_label.yml ================================================ name: PR label permissions: contents: read on: pull_request: types: [labeled, unlabeled, opened, reopened, synchronize] jobs: semver-label-check: name: Semantic version label check runs-on: ubuntu-latest timeout-minutes: 1 steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Check for Semantic Version label uses: ./.github/actions/pull_request_semver_label_checker/ ================================================ FILE: .github/workflows/release_builds.yml ================================================ name: Release builds permissions: contents: read on: workflow_call: inputs: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to false." default: false linux_5_10_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." default: "" linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." default: true linux_6_0_arguments_override: type: string description: "The arguments passed to swift test in the Linux 6.0 Swift version matrix job." default: "" linux_6_1_enabled: type: boolean description: "Boolean to enable the Linux 6.1 Swift version matrix job. Defaults to true." default: true linux_6_1_arguments_override: type: string description: "The arguments passed to swift test in the Linux 6.1 Swift version matrix job." default: "" linux_6_2_enabled: type: boolean description: "Boolean to enable the Linux 6.2 Swift version matrix job. Defaults to true." default: true linux_6_2_arguments_override: type: string description: "The arguments passed to swift test in the Linux 6.2 Swift version matrix job." default: "" linux_nightly_next_enabled: type: boolean description: "Boolean to enable the Linux matrix job using the nightly build for the next Swift version. Defaults to true." default: true linux_nightly_next_arguments_override: type: string description: "The arguments passed to swift test in the Linux matrix job using the nightly build for the next Swift version." default: "" linux_nightly_main_enabled: type: boolean description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." default: true linux_nightly_main_arguments_override: type: string description: "The arguments passed to swift test in the Linux nightly main Swift version matrix job." default: "" windows_6_0_enabled: type: boolean description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to false." default: false windows_6_0_arguments_override: type: string description: "The arguments passed to swift test in the Windows 6.0 Swift version matrix job." default: "" windows_6_1_enabled: type: boolean description: "Boolean to enable the Windows 6.1 Swift version matrix job. Defaults to false." default: false windows_6_1_arguments_override: type: string description: "The arguments passed to swift test in the Windows 6.1 Swift version matrix job." default: "" windows_6_2_enabled: type: boolean description: "Boolean to enable the Windows 6.2 Swift version matrix job. Defaults to false." default: false windows_6_2_arguments_override: type: string description: "The arguments passed to swift test in the Windows 6.2 Swift version matrix job." default: "" windows_nightly_next_enabled: type: boolean description: "Boolean to enable the Windows matrix job using the nightly build for the next Swift version. Defaults to false." default: false windows_nightly_next_arguments_override: type: string description: "The arguments passed to swift test in the Windows matrix job using the nightly build for the next Swift version." default: "" windows_nightly_main_enabled: type: boolean description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to false." default: false windows_nightly_main_arguments_override: type: string description: "The arguments passed to swift test in the Windows nightly main Swift version matrix job." default: "" linux_env_vars: type: string description: "Environment variables for Linux jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" windows_env_vars: type: string description: "Environment variables for Windows jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" minimum_swift_version: type: string description: "Minimum Swift version to include in the matrix. Leave empty for auto-detection from Package.swift, specify a version like '6.0' to override, or set to 'none' to disable filtering." default: "" jobs: construct-matrix: name: Construct release build matrix runs-on: ubuntu-latest outputs: release-build-matrix: '${{ steps.generate-matrix.outputs.release-build-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate JSON environment variables linux_env_vars_json="$INPUT_LINUX_ENV_VARS" windows_env_vars_json="$INPUT_WINDOWS_ENV_VARS" if ! echo "$linux_env_vars_json" | jq empty 2>/dev/null; then echo "Error: linux_env_vars is not valid JSON" exit 1 fi if ! echo "$windows_env_vars_json" | jq empty 2>/dev/null; then echo "Error: windows_env_vars is not valid JSON" exit 1 fi echo "release-build-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | MATRIX_LINUX_ENV_VARS_JSON="${linux_env_vars_json}" MATRIX_WINDOWS_ENV_VARS_JSON="${windows_env_vars_json}" bash)" >> "$GITHUB_OUTPUT" env: INPUT_LINUX_ENV_VARS: ${{ inputs.linux_env_vars }} INPUT_WINDOWS_ENV_VARS: ${{ inputs.windows_env_vars }} MATRIX_LINUX_SETUP_COMMAND: "swift --version" MATRIX_LINUX_COMMAND: "swift build -c release" MATRIX_MIN_SWIFT_VERSION: ${{ inputs.minimum_swift_version }} MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }} MATRIX_LINUX_5_10_COMMAND_ARGUMENTS: ${{ inputs.linux_5_10_arguments_override }} MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }} MATRIX_LINUX_6_0_COMMAND_ARGUMENTS: ${{ inputs.linux_6_0_arguments_override }} MATRIX_LINUX_6_1_ENABLED: ${{ inputs.linux_6_1_enabled }} MATRIX_LINUX_6_1_COMMAND_ARGUMENTS: ${{ inputs.linux_6_1_arguments_override }} MATRIX_LINUX_6_2_ENABLED: ${{ inputs.linux_6_2_enabled }} MATRIX_LINUX_6_2_COMMAND_ARGUMENTS: ${{ inputs.linux_6_2_arguments_override }} MATRIX_LINUX_NIGHTLY_NEXT_ENABLED: ${{ inputs.linux_nightly_next_enabled }} MATRIX_LINUX_NIGHTLY_NEXT_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_next_arguments_override }} MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }} MATRIX_LINUX_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_main_arguments_override }} MATRIX_WINDOWS_COMMAND: "swift build -c release" MATRIX_WINDOWS_6_0_ENABLED: ${{ inputs.windows_6_0_enabled }} MATRIX_WINDOWS_6_0_COMMAND_ARGUMENTS: ${{ inputs.windows_6_0_arguments_override }} MATRIX_WINDOWS_6_1_ENABLED: ${{ inputs.windows_6_1_enabled }} MATRIX_WINDOWS_6_1_COMMAND_ARGUMENTS: ${{ inputs.windows_6_1_arguments_override }} MATRIX_WINDOWS_6_2_ENABLED: ${{ inputs.windows_6_2_enabled }} MATRIX_WINDOWS_6_2_COMMAND_ARGUMENTS: ${{ inputs.windows_6_2_arguments_override }} MATRIX_WINDOWS_NIGHTLY_NEXT_ENABLED: ${{ inputs.windows_nightly_next_enabled }} MATRIX_WINDOWS_NIGHTLY_NEXT_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_next_arguments_override }} MATRIX_WINDOWS_NIGHTLY_MAIN_ENABLED: ${{ inputs.windows_nightly_main_enabled }} MATRIX_WINDOWS_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_main_arguments_override }} release-builds: name: Release builds needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Release builds" matrix_string: '${{ needs.construct-matrix.outputs.release-build-matrix }}' ================================================ FILE: .github/workflows/static_sdk.yml ================================================ name: Static SDK permissions: contents: read on: workflow_call: inputs: env_vars: type: string description: "Environment variables for jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" command_arguments: type: string description: "The arguments passed to swift build. Defaults to '--swift-sdk x86_64-swift-linux-musl'." default: "--swift-sdk x86_64-swift-linux-musl" jobs: construct-matrix: name: Construct Static SDK matrix runs-on: ubuntu-latest outputs: static-sdk-matrix: '${{ steps.generate-matrix.outputs.static-sdk-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate and use JSON environment variables directly env_vars_json="$INPUT_ENV_VARS" # Validate JSON format if ! echo "$env_vars_json" | jq empty 2>/dev/null; then echo "Error: env_vars is not valid JSON" exit 1 fi # Generate matrix with parsed environment variables cat >> "$GITHUB_OUTPUT" << EOM static-sdk-matrix=$(echo '{ "config":[ { "name":"latest-release Jammy", "swift_version":"latest-release", "platform":"Linux", "runner":"ubuntu-latest", "image":"ubuntu:jammy", "setup_command":"apt update -q && apt install -y -q curl jq tar && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_prerequisites.sh | bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh | INSTALL_SWIFT_VERSION=latest INSTALL_SWIFT_ARCH=x86_64 bash && hash -r", "command":"swift build", "command_arguments":"--swift-sdks-path /tmp/swiftsdks '"$INPUT_COMMAND_ARGUMENTS"'", "env":'"$env_vars_json"' }, { "name":"main Jammy", "swift_version":"main", "platform":"Linux", "runner":"ubuntu-latest", "image":"ubuntu:jammy", "setup_command":"apt update -q && apt install -y -q curl jq tar && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_prerequisites.sh | bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh | INSTALL_SWIFT_BRANCH=main INSTALL_SWIFT_ARCH=x86_64 bash && hash -r", "command":"swift build", "command_arguments":"--swift-sdks-path /tmp/swiftsdks '"$INPUT_COMMAND_ARGUMENTS"'", "env":'"$env_vars_json"' } ] }' | jq -c) EOM env: INPUT_ENV_VARS: ${{ inputs.env_vars }} INPUT_COMMAND_ARGUMENTS: ${{ inputs.command_arguments }} static-sdk: name: Static SDK needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Static SDK" matrix_string: '${{ needs.construct-matrix.outputs.static-sdk-matrix }}' ================================================ FILE: .github/workflows/swift_6_language_mode.yml ================================================ name: Swift 6 language mode permissions: contents: read on: workflow_call: # We are cancelling previously triggered workflow runs concurrency: group: ${{ github.workflow }}-${{ github.ref }}-swift-6-language-mode cancel-in-progress: true jobs: swift-6-language-mode: name: Swift 6 language mode runs-on: ubuntu-latest container: image: swift:6.0-jammy steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Set the language mode run: swift package tools-version --set 6.0 - name: Build with Swift 6 language mode run: swift build -Xswiftc -warnings-as-errors ================================================ FILE: .github/workflows/swift_load_test_matrix.yml ================================================ name: Matrix Load permissions: contents: read on: workflow_call: inputs: name: type: string description: "The name of the workflow used for the concurrency group." required: true matrix_path: type: string description: "The path of the test matrix definition." default: "" jobs: load-matrix: name: Prepare matrices runs-on: ubuntu-latest outputs: swift-matrix: ${{ steps.load-matrix.outputs.swift-matrix }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Mark the workspace as safe # https://github.com/actions/checkout/issues/766 run: git config --global --add safe.directory ${GITHUB_WORKSPACE} - id: load-matrix run: | printf "swift-matrix=%s" "$(jq -ec '.' "$INPUT_MATRIX_PATH")" >> "$GITHUB_OUTPUT" env: INPUT_MATRIX_PATH: ${{ inputs.matrix_path }} execute-matrix: name: Execute matrix needs: load-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: ${{ inputs.name }} matrix_string: '${{ needs.load-matrix.outputs.swift-matrix }}' ================================================ FILE: .github/workflows/swift_matrix.yml ================================================ name: Matrix permissions: contents: read on: workflow_call: inputs: name: type: string description: "The name of the workflow used for the concurrency group." required: true matrix_linux_command: type: string description: "The command of the current Swift version linux matrix job to execute." required: true matrix_linux_5_9_enabled: type: boolean description: "Boolean to enable the 5.9 Swift version matrix job. Defaults to false." default: false matrix_linux_5_9_container_image: type: string description: "Container image for the 5.9 Swift version matrix job. Defaults to matching Swift Ubuntu image." default: "swift:5.9-jammy" matrix_linux_5_9_command_override: type: string description: "The command of the 5.9 Swift version linux matrix job to execute." matrix_linux_5_10_enabled: type: boolean description: "Boolean to enable the 5.10 Swift version matrix job. Defaults to false." default: false matrix_linux_5_10_container_image: type: string description: "Container image for the 5.10 Swift version matrix job. Defaults to matching Swift Ubuntu image." default: "swift:5.10-jammy" matrix_linux_5_10_command_override: type: string description: "The command of the 5.10 Swift version linux matrix job to execute." matrix_linux_6_0_enabled: type: boolean description: "Boolean to enable the 6.0 Swift version matrix job. Defaults to true." default: true matrix_linux_6_0_container_image: type: string description: "Container image for the 6.0 Swift version matrix job. Defaults to matching Swift Ubuntu image." default: "swift:6.0-jammy" matrix_linux_6_0_command_override: type: string description: "The command of the 6.0 Swift version linux matrix job to execute." matrix_linux_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: true matrix_linux_nightly_6_0_container_image: type: string description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: "swiftlang/swift:nightly-6.0-jammy" matrix_linux_nightly_6_0_command_override: type: string description: "⚠️ Deprecated, we no longer run against 6.0 nightly." matrix_linux_nightly_6_1_enabled: type: boolean description: "Boolean to enable the nightly 6.1 Swift version matrix job. Defaults to true." default: true matrix_linux_nightly_6_1_container_image: type: string description: "Container image for the nightly 6.1 Swift version matrix job. Defaults to matching Swift Ubuntu image." default: "swiftlang/swift:nightly-6.1-jammy" matrix_linux_nightly_6_1_command_override: type: string description: "The command of the nightly 6.1 Swift version linux matrix job to execute." matrix_linux_nightly_main_enabled: type: boolean description: "Boolean to enable the nightly main Swift version matrix job. Defaults to true." default: true matrix_linux_nightly_main_container_image: type: string description: "Container image for the nightly main Swift version matrix job. Defaults to matching Swift Ubuntu image." default: "swiftlang/swift:nightly-main-jammy" matrix_linux_nightly_main_command_override: type: string description: "The command of the nightly main Swift version linux matrix job to execute." matrix_windows_command: type: string description: "The command of the current Swift version windows matrix job to execute." default: "" matrix_windows_6_0_enabled: type: boolean description: "Boolean to enable the 6.0 Swift version matrix job. Defaults to true." default: false matrix_windows_6_0_command_override: type: string description: "The command of the 6.0 Swift version windows matrix job to execute." matrix_windows_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: false matrix_windows_nightly_6_0_command_override: type: string description: "⚠️ Deprecated, we no longer run against 6.0 nightly." matrix_windows_nightly_6_1_enabled: type: boolean description: "Boolean to enable the nightly 6.1 Swift version matrix job. Defaults to true." default: false matrix_windows_nightly_6_1_command_override: type: string description: "The command of the nightly 6.1 Swift version windows matrix job to execute." matrix_windows_nightly_main_enabled: type: boolean description: "Boolean to enable the nightly main Swift version matrix job. Defaults to true." default: false matrix_windows_nightly_main_command_override: type: string description: "The command of the nightly main Swift version windows matrix job to execute." # We are cancelling previously triggered workflow runs concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }} cancel-in-progress: true jobs: linux: name: Linux (${{ matrix.swift.swift_version }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release swift: - image: ${{ inputs.matrix_linux_5_9_container_image }} swift_version: "5.9" enabled: ${{ inputs.matrix_linux_5_9_enabled }} - image: ${{ inputs.matrix_linux_5_10_container_image }} swift_version: "5.10" enabled: ${{ inputs.matrix_linux_5_10_enabled }} - image: ${{ inputs.matrix_linux_6_0_container_image }} swift_version: "6.0" enabled: ${{ inputs.matrix_linux_6_0_enabled }} - image: ${{ inputs.matrix_linux_nightly_6_1_container_image }} swift_version: "nightly-6.1" enabled: ${{ inputs.matrix_linux_nightly_6_1_enabled }} - image: ${{ inputs.matrix_linux_nightly_main_container_image }} swift_version: "nightly-main" enabled: ${{ inputs.matrix_linux_nightly_main_enabled }} container: image: ${{ matrix.swift.image }} steps: - name: Checkout repository if: ${{ matrix.swift.enabled }} uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Mark the workspace as safe if: ${{ matrix.swift.enabled }} # https://github.com/actions/checkout/issues/766 run: git config --global --add safe.directory ${GITHUB_WORKSPACE} - name: Run matrix job if: ${{ matrix.swift.enabled }} env: SWIFT_VERSION: ${{ matrix.swift.swift_version }} COMMAND: ${{ inputs.matrix_linux_command }} COMMAND_OVERRIDE_5_9: ${{ inputs.matrix_linux_5_9_command_override }} COMMAND_OVERRIDE_5_10: ${{ inputs.matrix_linux_5_10_command_override }} COMMAND_OVERRIDE_6_0: ${{ inputs.matrix_linux_6_0_command_override }} COMMAND_OVERRIDE_NIGHTLY_6_1: ${{ inputs.matrix_linux_nightly_6_1_command_override }} COMMAND_OVERRIDE_NIGHTLY_MAIN: ${{ inputs.matrix_linux_nightly_main_command_override }} run: | apt-get -qq update && apt-get -qq -y install curl curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash windows: name: Windows (${{ matrix.swift.swift_version }}) runs-on: windows-2022 strategy: fail-fast: false matrix: # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release swift: - image: swift:6.0-windowsservercore-ltsc2022 swift_version: "6.0" enabled: ${{ inputs.matrix_windows_6_0_enabled }} steps: - name: Wait for Docker daemon if: ${{ matrix.swift.enabled }} run: | $maxAttempts = 30 $attempt = 0 do { $attempt++ docker info 2>&1 | Out-Null if ($LASTEXITCODE -eq 0) { break } if ($attempt -ge $maxAttempts) { Write-Error "Docker daemon did not become ready after $maxAttempts attempts" exit 1 } Start-Sleep -Seconds 6 } while ($true) shell: pwsh - name: Pull Docker image if: ${{ matrix.swift.enabled }} run: docker pull ${{ matrix.swift.image }} - name: Checkout repository if: ${{ matrix.swift.enabled }} uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Donwload matrix script if: ${{ matrix.swift.enabled }} run: curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.ps1 -o __check-matrix-job.ps1 - name: Run matrix job if: ${{ matrix.swift.enabled }} run: | docker run --env SWIFT_VERSION="${{ matrix.swift.swift_version }}" --env COMMAND="$env:INPUT_WINDOWS_COMMAND" --env COMMAND_OVERRIDE_6_0="$env:INPUT_WINDOWS_6_0_OVERRIDE" -v ${{ github.workspace }}:C:\source ${{ matrix.swift.image }} cmd /s /c "swift --version & cd C:\source\ & powershell -File __check-matrix-job.ps1" env: INPUT_WINDOWS_COMMAND: ${{ inputs.matrix_windows_command }} INPUT_WINDOWS_6_0_OVERRIDE: ${{ inputs.matrix_windows_6_0_command_override }} windows-nightly: name: Windows (${{ matrix.swift.swift_version }}) runs-on: windows-2019 strategy: fail-fast: false matrix: # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release swift: - image: swiftlang/swift:nightly-6.1-windowsservercore-1809 swift_version: "nightly-6.1" enabled: ${{ inputs.matrix_windows_nightly_6_1_enabled }} - image: swiftlang/swift:nightly-main-windowsservercore-1809 swift_version: "nightly-main" enabled: ${{ inputs.matrix_windows_nightly_main_enabled }} steps: - name: Wait for Docker daemon if: ${{ matrix.swift.enabled }} run: | $maxAttempts = 30 $attempt = 0 do { $attempt++ docker info 2>&1 | Out-Null if ($LASTEXITCODE -eq 0) { break } if ($attempt -ge $maxAttempts) { Write-Error "Docker daemon did not become ready after $maxAttempts attempts" exit 1 } Start-Sleep -Seconds 6 } while ($true) shell: pwsh - name: Pull Docker image if: ${{ matrix.swift.enabled }} run: docker pull ${{ matrix.swift.image }} - name: Checkout repository if: ${{ matrix.swift.enabled }} uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Donwload matrix script if: ${{ matrix.swift.enabled }} run: curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.ps1 -o __check-matrix-job.ps1 - name: Run matrix job if: ${{ matrix.swift.enabled }} run: | docker run --env SWIFT_VERSION="${{ matrix.swift.swift_version }}" --env COMMAND="$env:INPUT_WINDOWS_COMMAND" --env COMMAND_OVERRIDE_NIGHTLY_6_1="$env:INPUT_WINDOWS_NIGHTLY_6_1_OVERRIDE" --env COMMAND_OVERRIDE_NIGHTLY_MAIN="$env:INPUT_WINDOWS_NIGHTLY_MAIN_OVERRIDE" -v ${{ github.workspace }}:C:\source ${{ matrix.swift.image }} cmd /s /c "swift --version & cd C:\source\ & powershell -File __check-matrix-job.ps1" env: INPUT_WINDOWS_COMMAND: ${{ inputs.matrix_windows_command }} INPUT_WINDOWS_NIGHTLY_6_1_OVERRIDE: ${{ inputs.matrix_windows_nightly_6_1_command_override }} INPUT_WINDOWS_NIGHTLY_MAIN_OVERRIDE: ${{ inputs.matrix_windows_nightly_main_command_override }} ================================================ FILE: .github/workflows/swift_test_matrix.yml ================================================ name: Matrix permissions: contents: read on: workflow_call: inputs: name: type: string description: "The name of the workflow used for the concurrency group." required: true matrix_string: type: string description: "The test matrix definition." required: true # We will cancel previously triggered workflow runs concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }} cancel-in-progress: true jobs: execute-matrix: name: ${{ matrix.config.platform }} (${{ matrix.config.name }}) runs-on: ${{ matrix.config.runner }} strategy: fail-fast: false matrix: ${{ fromJson(inputs.matrix_string) }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false submodules: true - name: Wait for Docker daemon (Windows) if: ${{ matrix.config.platform == 'Windows' }} run: | $maxAttempts = 30 $attempt = 0 do { $attempt++ docker info 2>&1 | Out-Null if ($LASTEXITCODE -eq 0) { break } if ($attempt -ge $maxAttempts) { Write-Error "Docker daemon did not become ready after $maxAttempts attempts" exit 1 } Start-Sleep -Seconds 6 } while ($true) shell: pwsh - name: Pull Docker image run: docker pull ${{ matrix.config.image }} - name: Run matrix job if: ${{ matrix.config.platform != 'Windows' }} run: | if [[ -n "$MATRIX_SETUP_COMMAND" ]]; then setup_command_expression="$MATRIX_SETUP_COMMAND &&" else setup_command_expression="" fi workspace="/$(basename "$GITHUB_WORKSPACE")" docker_args=( "run" "-v" "$GITHUB_WORKSPACE:$workspace" "-w" "$workspace" "-e" "CI=$CI" "-e" "GITHUB_ACTIONS=$GITHUB_ACTIONS" "-e" "SWIFT_VERSION=$MATRIX_SWIFT_VERSION" "-e" "workspace=$workspace" ) if [[ "$MATRIX_ENV_JSON" != '{}' ]]; then while IFS="=" read -r key value; do if [[ -n "$key" && -n "$value" ]]; then docker_args+=("-e" "$key=$value") fi done < <(echo "$MATRIX_ENV_JSON" | jq -r 'to_entries[] | "\(.key)=\(.value)"') fi docker_args+=("$MATRIX_IMAGE") docker_args+=("bash" "-c" "$setup_command_expression $MATRIX_COMMAND $MATRIX_COMMAND_ARGUMENTS") echo "Executing Docker command: docker ${docker_args[*]}" docker "${docker_args[@]}" env: MATRIX_SETUP_COMMAND: ${{ matrix.config.setup_command }} MATRIX_SWIFT_VERSION: ${{ matrix.config.swift_version }} MATRIX_IMAGE: ${{ matrix.config.image }} MATRIX_COMMAND: ${{ matrix.config.command }} MATRIX_COMMAND_ARGUMENTS: ${{ matrix.config.command_arguments }} MATRIX_ENV_JSON: ${{ toJson(matrix.config.env) }} GITHUB_WORKSPACE: ${{ github.workspace }} - name: Run matrix job (Windows) if: ${{ matrix.config.platform == 'Windows' }} run: | if (-not [string]::IsNullOrEmpty("$env:MATRIX_SETUP_COMMAND")) { $setup_command_expression = "$env:MATRIX_SETUP_COMMAND &" } else { $setup_command_expression = "" } $workspace = "C:\" + (Split-Path $env:GITHUB_WORKSPACE -Leaf) $docker_args = @( "run", "-v", "$env:GITHUB_WORKSPACE`:$($workspace)", "-w", $workspace, "-e", "CI=$env:CI", "-e", "GITHUB_ACTIONS=$env:GITHUB_ACTIONS", "-e", "SWIFT_VERSION=$env:MATRIX_SWIFT_VERSION" ) $env_args = @() $env_json = $env:MATRIX_ENV_JSON if ($env_json -ne '{}') { $env_obj = $env_json | ConvertFrom-Json $env_obj.PSObject.Properties | ForEach-Object { $env_args += "-e" $env_args += "$($_.Name)=$($_.Value)" } } $docker_args += $env_args $docker_args += @("$env:MATRIX_IMAGE", "cmd", "/s", "/c", "swift --version & $($setup_command_expression) $env:MATRIX_COMMAND $env:MATRIX_COMMAND_ARGUMENTS") Write-Host "Executing Docker command: docker $($docker_args -join ' ')" & docker @docker_args env: MATRIX_SETUP_COMMAND: ${{ matrix.config.setup_command }} MATRIX_SWIFT_VERSION: ${{ matrix.config.swift_version }} MATRIX_IMAGE: ${{ matrix.config.image }} MATRIX_COMMAND: ${{ matrix.config.command }} MATRIX_COMMAND_ARGUMENTS: ${{ matrix.config.command_arguments }} MATRIX_ENV_JSON: ${{ toJson(matrix.config.env) }} GITHUB_WORKSPACE: ${{ github.workspace }} env: SWIFT_VERSION: ${{ matrix.config.swift_version }} ================================================ FILE: .github/workflows/unit_tests.yml ================================================ name: Unit tests permissions: contents: read on: workflow_call: inputs: linux_5_9_enabled: type: boolean description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to false." default: false linux_5_9_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.9 Swift version matrix job." default: "" linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to false." default: false linux_5_10_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." default: "" linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." default: true linux_6_0_arguments_override: type: string description: "The arguments passed to swift test in the Linux 6.0 Swift version matrix job." default: "" linux_6_1_enabled: type: boolean description: "Boolean to enable the Linux 6.1 Swift version matrix job. Defaults to true." default: true linux_6_1_arguments_override: type: string description: "The arguments passed to swift test in the Linux 6.1 Swift version matrix job." default: "" linux_6_2_enabled: type: boolean description: "Boolean to enable the Linux 6.2 Swift version matrix job. Defaults to true." default: true linux_6_2_arguments_override: type: string description: "The arguments passed to swift test in the Linux 6.2 Swift version matrix job." default: "" linux_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: true linux_nightly_6_0_arguments_override: type: string description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: "" linux_nightly_6_1_enabled: type: boolean description: "⚠️ Deprecated, use linux_nightly_next_enabled." default: true linux_nightly_6_1_arguments_override: type: string description: "⚠️ Deprecated, use linux_nightly_next_arguments_override." default: "" linux_nightly_next_enabled: type: boolean description: "Boolean to enable the Linux matrix job using the nightly build for the next Swift version. Defaults to true." default: true linux_nightly_next_arguments_override: type: string description: "The arguments passed to swift test in the Linux matrix job using the nightly build for the next Swift version." default: "" linux_nightly_main_enabled: type: boolean description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." default: true linux_nightly_main_arguments_override: type: string description: "The arguments passed to swift test in the Linux nightly main Swift version matrix job." default: "" windows_6_0_enabled: type: boolean description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to false." default: false windows_6_0_arguments_override: type: string description: "The arguments passed to swift test in the Windows 6.0 Swift version matrix job." default: "" windows_6_1_enabled: type: boolean description: "Boolean to enable the Windows 6.1 Swift version matrix job. Defaults to false." default: false windows_6_1_arguments_override: type: string description: "The arguments passed to swift test in the Windows 6.1 Swift version matrix job." default: "" windows_6_2_enabled: type: boolean description: "Boolean to enable the Windows 6.2 Swift version matrix job. Defaults to false." default: false windows_6_2_arguments_override: type: string description: "The arguments passed to swift test in the Windows 6.2 Swift version matrix job." default: "" windows_nightly_6_0_enabled: type: boolean description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: false windows_nightly_6_0_arguments_override: type: string description: "⚠️ Deprecated, we no longer run against 6.0 nightly." default: "" windows_nightly_6_1_enabled: type: boolean description: "⚠️ Deprecated, use windows_nightly_next_enabled." default: false windows_nightly_6_1_arguments_override: type: string description: "⚠️ Deprecated, use windows_nightly_next_arguments_override." default: "" windows_nightly_next_enabled: type: boolean description: "Boolean to enable the Windows matrix job using the nightly build for the next Swift version. Defaults to false." default: false windows_nightly_next_arguments_override: type: string description: "The arguments passed to swift test in the Windows matrix job using the nightly build for the next Swift version." default: "" windows_nightly_main_enabled: type: boolean description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to false." default: false windows_nightly_main_arguments_override: type: string description: "The arguments passed to swift test in the Windows nightly main Swift version matrix job." default: "" linux_env_vars: type: string description: "Environment variables for Linux jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" windows_env_vars: type: string description: "Environment variables for Windows jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" minimum_swift_version: type: string description: "Minimum Swift version to include in the matrix. Leave empty for auto-detection from Package.swift, specify a version like '6.0' to override, or set to 'none' to disable filtering." default: "" jobs: construct-matrix: name: Construct unit test matrix runs-on: ubuntu-latest outputs: unit-test-matrix: '${{ steps.generate-matrix.outputs.unit-test-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate and use JSON environment variables directly linux_env_vars_json="$INPUT_LINUX_ENV_VARS" windows_env_vars_json="$INPUT_WINDOWS_ENV_VARS" # Validate JSON format if ! echo "$linux_env_vars_json" | jq empty 2>/dev/null; then echo "Error: linux_env_vars is not valid JSON" exit 1 fi if ! echo "$windows_env_vars_json" | jq empty 2>/dev/null; then echo "Error: windows_env_vars is not valid JSON" exit 1 fi # Generate matrix echo "unit-test-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | MATRIX_LINUX_ENV_VARS_JSON="${linux_env_vars_json}" MATRIX_WINDOWS_ENV_VARS_JSON="${windows_env_vars_json}" bash)" >> "$GITHUB_OUTPUT" env: INPUT_LINUX_ENV_VARS: ${{ inputs.linux_env_vars }} INPUT_WINDOWS_ENV_VARS: ${{ inputs.windows_env_vars }} MATRIX_LINUX_SETUP_COMMAND: "swift --version" MATRIX_LINUX_COMMAND: "swift test" MATRIX_MIN_SWIFT_VERSION: ${{ inputs.minimum_swift_version }} MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }} MATRIX_LINUX_5_9_COMMAND_ARGUMENTS: ${{ inputs.linux_5_9_arguments_override }} MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }} MATRIX_LINUX_5_10_COMMAND_ARGUMENTS: ${{ inputs.linux_5_10_arguments_override }} MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }} MATRIX_LINUX_6_0_COMMAND_ARGUMENTS: ${{ inputs.linux_6_0_arguments_override }} MATRIX_LINUX_6_1_ENABLED: ${{ inputs.linux_6_1_enabled }} MATRIX_LINUX_6_1_COMMAND_ARGUMENTS: ${{ inputs.linux_6_1_arguments_override }} MATRIX_LINUX_6_2_ENABLED: ${{ inputs.linux_6_2_enabled }} MATRIX_LINUX_6_2_COMMAND_ARGUMENTS: ${{ inputs.linux_6_2_arguments_override }} MATRIX_LINUX_NIGHTLY_NEXT_ENABLED: ${{ inputs.linux_nightly_6_1_enabled || inputs.linux_nightly_next_enabled }} MATRIX_LINUX_NIGHTLY_NEXT_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_6_1_arguments_override }} ${{ inputs.linux_nightly_next_arguments_override }} MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }} MATRIX_LINUX_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_main_arguments_override }} MATRIX_WINDOWS_COMMAND: "swift test" MATRIX_WINDOWS_6_0_ENABLED: ${{ inputs.windows_6_0_enabled }} MATRIX_WINDOWS_6_0_COMMAND_ARGUMENTS: ${{ inputs.windows_6_0_arguments_override }} MATRIX_WINDOWS_6_1_ENABLED: ${{ inputs.windows_6_1_enabled }} MATRIX_WINDOWS_6_1_COMMAND_ARGUMENTS: ${{ inputs.windows_6_1_arguments_override }} MATRIX_WINDOWS_6_2_ENABLED: ${{ inputs.windows_6_2_enabled }} MATRIX_WINDOWS_6_2_COMMAND_ARGUMENTS: ${{ inputs.windows_6_2_arguments_override }} MATRIX_WINDOWS_NIGHTLY_NEXT_ENABLED: ${{ inputs.windows_nightly_6_1_enabled || inputs.windows_nightly_next_enabled }} MATRIX_WINDOWS_NIGHTLY_NEXT_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_6_1_arguments_override }} ${{ inputs.windows_nightly_next_arguments_override }} MATRIX_WINDOWS_NIGHTLY_MAIN_ENABLED: ${{ inputs.windows_nightly_main_enabled }} MATRIX_WINDOWS_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_main_arguments_override }} unit-tests: name: Unit tests needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "Unit tests" matrix_string: '${{ needs.construct-matrix.outputs.unit-test-matrix }}' ================================================ FILE: .github/workflows/wasm_swift_sdk.yml ================================================ name: WebAssembly Swift SDK permissions: contents: read on: workflow_call: inputs: env_vars: type: string description: "Environment variables for jobs as JSON (e.g., '{\"DEBUG\":\"1\",\"LOG_LEVEL\":\"info\"}')." default: "{}" additional_command_arguments: type: string description: "Additional arguments passed to swift build (the Wasm Swift SDK will be specified). Defaults to empty." default: "" jobs: construct-matrix: name: Construct WebAssembly Swift SDK matrix runs-on: ubuntu-latest outputs: wasm-swift-sdk-matrix: '${{ steps.generate-matrix.outputs.wasm-swift-sdk-matrix }}' steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - id: generate-matrix run: | # Validate and use JSON environment variables directly env_vars_json="$INPUT_ENV_VARS" # Validate JSON format if ! echo "$env_vars_json" | jq empty 2>/dev/null; then echo "Error: env_vars is not valid JSON" exit 1 fi # Generate matrix with parsed environment variables cat >> "$GITHUB_OUTPUT" << EOM wasm-swift-sdk-matrix=$(echo '{ "config":[ { "name":"main Jammy", "swift_version":"main", "platform":"Linux", "runner":"ubuntu-latest", "image":"ubuntu:jammy", "setup_command":"apt update -q && apt install -y -q curl jq tar && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_prerequisites.sh | bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh | INSTALL_SWIFT_BRANCH=main INSTALL_SWIFT_ARCH=x86_64 INSTALL_SWIFT_SDK=wasm-sdk bash && hash -r", "command":"curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/swift-build-with-wasm-sdk.sh | bash -s --", "command_arguments":"'"$INPUT_ADDITIONAL_COMMAND_ARGUMENTS"'", "env":'"$env_vars_json"' } ] }' | jq -c) EOM env: INPUT_ENV_VARS: ${{ inputs.env_vars }} INPUT_ADDITIONAL_COMMAND_ARGUMENTS: ${{ inputs.additional_command_arguments }} wasm-swift-sdk: name: WebAssembly Swift SDK needs: construct-matrix # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main with: name: "WebAssembly Swift SDK" matrix_string: '${{ needs.construct-matrix.outputs.wasm-swift-sdk-matrix }}' ================================================ FILE: .gitignore ================================================ .DS_Store .build /.index-build /Packages /*.xcodeproj Package.pins *.pem /docs/1.* /docs/2.* Package.resolved .podspecs DerivedData .swiftpm .*.sw? .vscode/launch.json ================================================ FILE: .licenseignore ================================================ .gitignore **/.gitignore .licenseignore .gitattributes .git-blame-ignore-revs .mailfilter .mailmap .spi.yml .swift-format .editorconfig .github/* *.md *.txt *.yml *.yaml *.json Package.swift **/Package.swift Package@-*.swift **/Package@-*.swift Package.resolved **/Package.resolved Makefile *.modulemap **/*.modulemap **/*.docc/* *.xcprivacy **/*.xcprivacy *.symlink **/*.symlink Dockerfile **/Dockerfile Snippets/* Sources/CNIOAtomics/src/cpp_magic.h Sources/CNIOLLHTTP/LICENSE Sources/CNIOLLHTTP/c_nio_api.c Sources/CNIOLLHTTP/c_nio_http.c Sources/CNIOLLHTTP/c_nio_llhttp.c Sources/CNIOLLHTTP/include/c_nio_llhttp.h Sources/CNIOSHA1/c_nio_sha1.c Sources/CNIOSHA1/include/CNIOSHA1.h dev/alloc-limits-from-test-output dev/boxed-existentials.d dev/git.commit.template dev/lldb-smoker dev/make-single-file-spm dev/malloc-aggregation.d dev/malloc-aggregation.bt dev/update-alloc-limits-to-last-completed-ci-build scripts/nio-diagnose ================================================ FILE: .mailfilter ================================================ # This is a list of `shasum` hashed email addresses which are filtered from CONTRIBUTORS.txt, typically for privacy. # Lines can be generated by running `echo -n 'My Name ' | shasum | head -c 40`. 38268a29b340ecfb435c5e6c5827a596acb71cc6 886d1da6503c6de1d630beaf6acb667e4ce3e2a0 f0c2beeae30f3012fa02257998baca1737540bda ================================================ FILE: .mailmap ================================================ Tomer Doron Tomer Doron Tomer Doron tomer doron Max Moiseev Johannes Weiss Johannes Weiss Johannes Weiss Adam Nemecek Jim Dovey Tim Condon <0xtimc@gmail.com> Tim <0xTim@users.noreply.github.com> Tim Condon <0xtimc@gmail.com> <0xTim@users.noreply.github.com> Tim Condon <0xtimc@gmail.com> Tim <0xtimc@gmail.com> George Barnett Alex Blewitt Ben Cohen Jason Toffaletti Gwynne Raskind Gwynne Raskind Gwynne Raskind Kevin Sweeney Lev Walkin Ludovic Dewailly Konrad `ktoso` Malawski Konrad `ktoso` Malawski Artem Redkin Jovan Milenkovic Nathan Harris Sergo Beruashvili <2391557+ogres@users.noreply.github.com> Sergej Jaskiewicz Siemen Sikkema Dario Rexin Romain Pouclet Julian Lettner Mario Sangiorgio Marli Oshlack David Evans Jake Foster <2bjake@users.noreply.github.com> Emil Marashliev Heidi Puk Hermann <32973281+heidipuk@users.noreply.github.com> Joachim M. <32777429+Lupurus@users.noreply.github.com> Richard Low Pushparaj Zala Christian Priebe Peter Adams <61008809+PeterAdams76@users.noreply.github.com> Peter Adams <63288215+PeterAdams-A@users.noreply.github.com> Shekhar Rajak <60732970+shekhar-rajak@users.noreply.github.com> Liam Flynn Andrew Naylor Andrius Aucinas Andrius Aucinas Fabian Fett Fabian Fett Graeme Jenkinson Max Desiatov Joshua Rutkowski <54906829+joshrutkowski@users.noreply.github.com> Rémi Doreau <32459935+ayshiff@users.noreply.github.com> Franz Busch David Nadoba Si Beaumont Benedict St. <52418145+BenedictSt@users.noreply.github.com> Austin Payne Donghyeon Kim Guillaume Lessard Joakim Hassila Stepan Ulyanin <99296376+stepan-ulyanin@users.noreply.github.com> Finagolfin Paul Schmiedmayer John Connolly Rick Newton-Rogers <104022490+rnro@users.noreply.github.com> ================================================ FILE: .spi.yml ================================================ version: 1 builder: configs: - documentation_targets: [NIO, NIOConcurrencyHelpers, NIOCore, NIOEmbedded, NIOFoundationCompat, NIOHTTP1, NIOPosix, NIOTLS, NIOWebSocket, NIOTestUtils, _NIOFileSystem, NIOFileSystem] ================================================ FILE: .swift-format ================================================ { "version" : 1, "indentation" : { "spaces" : 4 }, "tabWidth" : 4, "fileScopedDeclarationPrivacy" : { "accessLevel" : "private" }, "spacesAroundRangeFormationOperators" : false, "indentConditionalCompilationBlocks" : false, "indentSwitchCaseLabels" : false, "lineBreakAroundMultilineExpressionChainComponents" : false, "lineBreakBeforeControlFlowKeywords" : false, "lineBreakBeforeEachArgument" : true, "lineBreakBeforeEachGenericRequirement" : true, "lineLength" : 120, "maximumBlankLines" : 1, "respectsExistingLineBreaks" : true, "prioritizeKeepingFunctionOutputTogether" : true, "rules" : { "AllPublicDeclarationsHaveDocumentation" : false, "AlwaysUseLiteralForEmptyCollectionInit" : false, "AlwaysUseLowerCamelCase" : false, "AmbiguousTrailingClosureOverload" : true, "BeginDocumentationCommentWithOneLineSummary" : false, "DoNotUseSemicolons" : true, "DontRepeatTypeInStaticProperties" : true, "FileScopedDeclarationPrivacy" : true, "FullyIndirectEnum" : true, "GroupNumericLiterals" : true, "IdentifiersMustBeASCII" : true, "NeverForceUnwrap" : false, "NeverUseForceTry" : false, "NeverUseImplicitlyUnwrappedOptionals" : false, "NoAccessLevelOnExtensionDeclaration" : true, "NoAssignmentInExpressions" : true, "NoBlockComments" : true, "NoCasesWithOnlyFallthrough" : true, "NoEmptyTrailingClosureParentheses" : true, "NoLabelsInCasePatterns" : true, "NoLeadingUnderscores" : false, "NoParensAroundConditions" : true, "NoVoidReturnOnFunctionSignature" : true, "OmitExplicitReturns" : true, "OneCasePerLine" : true, "OneVariableDeclarationPerLine" : true, "OnlyOneTrailingClosureArgument" : true, "OrderedImports" : true, "ReplaceForEachWithForLoop" : true, "ReturnVoidInsteadOfEmptyTuple" : true, "UseEarlyExits" : false, "UseExplicitNilCheckInConditions" : false, "UseLetInEveryBoundCaseVariable" : false, "UseShorthandTypeNames" : true, "UseSingleLinePropertyGetter" : false, "UseSynthesizedInitializer" : false, "UseTripleSlashForDocumentationComments" : true, "UseWhereClausesInForLoops" : false, "ValidateDocumentationComments" : false } } ================================================ FILE: Benchmarks/.gitignore ================================================ .DS_Store /.build /Packages xcuserdata/ DerivedData/ .swiftpm/configuration/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc .benchmarkBaselines/ ================================================ FILE: Benchmarks/Benchmarks/NIOCoreBenchmarks/Benchmarks.swift ================================================ //===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project // // Copyright (c) 2024 Apple Inc. and the SwiftNIO project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of SwiftNIO project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// import Benchmark import NIOCore import NIOEmbedded // MARK: - Handlers for AddressedEnvelope benchmarks private final class ByteBufferEnvelopeForwardingHandler: ChannelInboundHandler, Sendable { typealias InboundIn = AddressedEnvelope func channelRead(context: ChannelHandlerContext, data: NIOAny) { context.fireChannelRead(data) } } private final class StringEnvelopeForwardingHandler: ChannelInboundHandler, Sendable { typealias InboundIn = AddressedEnvelope func channelRead(context: ChannelHandlerContext, data: NIOAny) { context.fireChannelRead(data) } } // MARK: - Handlers for ChannelPipeline benchmarks private final class NoOpHandler: ChannelInboundHandler, Sendable { typealias InboundIn = Any } // MARK: - Benchmarks let benchmarks = { #if LOCAL_TESTING let defaultMetrics: [BenchmarkMetric] = [ .mallocCountTotal, .contextSwitches, .wallClock, .instructions, ] #else let defaultMetrics: [BenchmarkMetric] = [ .mallocCountTotal ] #endif let leakMetrics: [BenchmarkMetric] = [ .mallocCountTotal, .memoryLeaked, ] Benchmark( "NIOAsyncChannel.init", configuration: .init( metrics: defaultMetrics, scalingFactor: .kilo, maxDuration: .seconds(10_000_000), maxIterations: 10 ) ) { benchmark in // Elide the cost of the 'EmbeddedChannel'. It's only used for its pipeline. var channels: [EmbeddedChannel] = [] channels.reserveCapacity(benchmark.scaledIterations.count) for _ in 0..(wrappingChannelSynchronously: channel) blackHole(asyncChanel) } } Benchmark( "WaitOnPromise", configuration: .init( metrics: leakMetrics, scalingFactor: .kilo, maxDuration: .seconds(10_000_000), maxIterations: 10_000 // need 10k to get a signal ) ) { benchmark in // Elide the cost of the 'EmbeddedEventLoop'. let el = EmbeddedEventLoop() benchmark.startMeasurement() defer { benchmark.stopMeasurement() } for _ in 0..? = try! channel.readInbound() blackHole(result) } } Benchmark( "AddressedEnvelope.ByteBuffer.withMetadata", configuration: .init( metrics: defaultMetrics, scalingFactor: .kilo, maxDuration: .seconds(10_000_000), maxIterations: 10 ) ) { benchmark in // Setup: Create channel with 20 forwarding handlers let channel = EmbeddedChannel() for _ in 0..<20 { try! channel.pipeline.syncOperations.addHandler(ByteBufferEnvelopeForwardingHandler()) } // Create the envelope with full metadata let address = try! SocketAddress(ipAddress: "::1", port: 8080) let buffer = ByteBuffer(string: "test data") let metadata = AddressedEnvelope.Metadata( ecnState: .transportNotCapable, packetInfo: NIOPacketInfo(destinationAddress: address, interfaceIndex: 1), segmentSize: 1200 ) let envelope = AddressedEnvelope(remoteAddress: address, data: buffer, metadata: metadata) benchmark.startMeasurement() defer { benchmark.stopMeasurement() } for _ in 0..? = try! channel.readInbound() blackHole(result) } } Benchmark( "AddressedEnvelope.String.noMetadata", configuration: .init( metrics: defaultMetrics, scalingFactor: .kilo, maxDuration: .seconds(10_000_000), maxIterations: 10 ) ) { benchmark in // Setup: Create channel with 20 forwarding handlers let channel = EmbeddedChannel() for _ in 0..<20 { try! channel.pipeline.syncOperations.addHandler(StringEnvelopeForwardingHandler()) } // Create the envelope without metadata let address = try! SocketAddress(ipAddress: "::1", port: 8080) let envelope = AddressedEnvelope(remoteAddress: address, data: "test data") benchmark.startMeasurement() defer { benchmark.stopMeasurement() } for _ in 0..? = try! channel.readInbound() blackHole(result) } } Benchmark( "AddressedEnvelope.String.withMetadata", configuration: .init( metrics: defaultMetrics, scalingFactor: .kilo, maxDuration: .seconds(10_000_000), maxIterations: 10 ) ) { benchmark in // Setup: Create channel with 20 forwarding handlers let channel = EmbeddedChannel() for _ in 0..<20 { try! channel.pipeline.syncOperations.addHandler(StringEnvelopeForwardingHandler()) } // Create the envelope with full metadata let address = try! SocketAddress(ipAddress: "::1", port: 8080) let metadata = AddressedEnvelope.Metadata( ecnState: .transportNotCapable, packetInfo: NIOPacketInfo(destinationAddress: address, interfaceIndex: 1), segmentSize: 1200 ) let envelope = AddressedEnvelope(remoteAddress: address, data: "test data", metadata: metadata) benchmark.startMeasurement() defer { benchmark.stopMeasurement() } for _ in 0..? = try! channel.readInbound() blackHole(result) } } Benchmark( "ChannelPipeline.init(0 handlers)", configuration: .init( metrics: defaultMetrics, scalingFactor: .kilo, maxDuration: .seconds(10_000_000), maxIterations: 1000 ) ) { benchmark in let channel = EmbeddedChannel() benchmark.startMeasurement() defer { benchmark.stopMeasurement() } for _ in 0..) in eventLoop.execute { continuation.resume() } } } } final actor Foo { nonisolated public let unownedExecutor: UnownedSerialExecutor init(eventLoop: any EventLoop) { self.unownedExecutor = eventLoop.executor.asUnownedSerialExecutor() } func foo() { blackHole(Void()) } } Benchmark( "Jump to EL and back using actor with EL executor", configuration: .init( metrics: defaultMetrics, scalingFactor: .kilo ) ) { benchmark in let actor = Foo(eventLoop: eventLoop) for _ in benchmark.scaledIterations { await actor.foo() } } // MARK: - NIOThreadPool submit benchmarks // Serial wakeup: submit one item, wait for completion, repeat. // Every submit hits N sleeping threads — this is where wake-one // vs wake-all (thundering herd) matters most. let pool16 = NIOThreadPool(numberOfThreads: 16) let pool4 = NIOThreadPool(numberOfThreads: 4) Benchmark( "NIOThreadPool.serial_wakeup(16 threads)", configuration: .init( metrics: [.wallClock, .cpuUser, .cpuSystem, .cpuTotal, .contextSwitches, .syscalls], maxDuration: .seconds(30), maxIterations: 30, setup: { pool16.start() }, teardown: { try! pool16.syncShutdownGracefully() } ) ) { _ in runNIOThreadPoolSerialWakeup(pool: pool16, count: 10_000) } Benchmark( "NIOThreadPool.serial_wakeup(4 threads)", configuration: .init( metrics: [.wallClock, .cpuUser, .cpuSystem, .cpuTotal, .contextSwitches, .syscalls], maxDuration: .seconds(30), maxIterations: 30, setup: { pool4.start() }, teardown: { try! pool4.syncShutdownGracefully() } ) ) { _ in runNIOThreadPoolSerialWakeup(pool: pool4, count: 10_000) } } ================================================ FILE: Benchmarks/Benchmarks/NIOPosixBenchmarks/NIOThreadPoolBenchmark.swift ================================================ //===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project // // Copyright (c) 2026 Apple Inc. and the SwiftNIO project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of SwiftNIO project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// import Dispatch import NIOCore import NIOPosix func runNIOThreadPoolSerialWakeup(pool: NIOThreadPool, count: Int) { let sem = DispatchSemaphore(value: 0) for _ in 0.. private var receivedData = 0 init(numberOfWrites: Int, readsCompletePromise: EventLoopPromise) { self.numberOfWrites = numberOfWrites self.readsCompletePromise = readsCompletePromise self.data = NIOAny(ByteBuffer(repeating: 0, count: self.messageSize)) } func channelActive(context: ChannelHandlerContext) { for _ in 0.. typealias OutboundOut = AddressedEnvelope func channelRead(context: ChannelHandlerContext, data: NIOAny) { context.write(data, promise: nil) } func channelReadComplete(context: ChannelHandlerContext) { context.flush() } } private final class UDPEchoRequestHandler: ChannelInboundHandler { typealias InboundIn = AddressedEnvelope typealias OutboundOut = AddressedEnvelope private let buffer = ByteBuffer(repeating: 0, count: 512) private let numberOfWrites: Int private let remoteAddress: SocketAddress private var receivedCount = 0 private let readsCompletePromise: EventLoopPromise init( numberOfWrites: Int, remoteAddress: SocketAddress, readsCompletePromise: EventLoopPromise ) { self.numberOfWrites = numberOfWrites self.remoteAddress = remoteAddress self.readsCompletePromise = readsCompletePromise } func channelActive(context: ChannelHandlerContext) { self.writeAgain(context: context) } func channelRead(context: ChannelHandlerContext, data: NIOAny) { self.receivedCount += 1 if self.receivedCount == self.numberOfWrites { self.readsCompletePromise.succeed() } else { self.writeAgain(context: context) } } private func writeAgain(context: ChannelHandlerContext) { let envelope = AddressedEnvelope( remoteAddress: self.remoteAddress, data: buffer ) context.write(Self.wrapOutboundOut(envelope), promise: nil) context.flush() } } func runUDPEcho(numberOfWrites: Int, eventLoop: any EventLoop) throws { let address = try SocketAddress.makeAddressResolvingHost("127.0.0.1", port: 0) // Create server channel let serverChannel = try DatagramBootstrap(group: eventLoop) .channelInitializer { channel in channel.eventLoop.makeCompletedFuture { try channel.pipeline.syncOperations.addHandler(UDPEchoHandler()) } } .bind(to: address) .wait() let readsCompletePromise = eventLoop.makePromise(of: Void.self) // Create client channel let clientChannel = try DatagramBootstrap(group: eventLoop) .channelInitializer { channel in channel.eventLoop.makeCompletedFuture { let handler = UDPEchoRequestHandler( numberOfWrites: numberOfWrites, remoteAddress: serverChannel.localAddress!, readsCompletePromise: readsCompletePromise ) try channel.pipeline.syncOperations.addHandler(handler) } } .bind(to: address) .wait() // Wait for all echoes to complete try readsCompletePromise.futureResult.wait() // Cleanup try serverChannel.close().wait() try clientChannel.close().wait() } func runUDPEchoPacketInfo(numberOfWrites: Int, eventLoop: any EventLoop) throws { let address = try SocketAddress.makeAddressResolvingHost("127.0.0.1", port: 0) // Create server channel with receivePacketInfo enabled let serverChannel = try DatagramBootstrap(group: eventLoop) .channelOption(.receivePacketInfo, value: true) .channelInitializer { channel in channel.eventLoop.makeCompletedFuture { try channel.pipeline.syncOperations.addHandler(UDPEchoHandler()) } } .bind(to: address) .wait() let readsCompletePromise = eventLoop.makePromise(of: Void.self) // Create client channel with receivePacketInfo enabled let clientChannel = try DatagramBootstrap(group: eventLoop) .channelOption(.receivePacketInfo, value: true) .channelInitializer { channel in channel.eventLoop.makeCompletedFuture { let handler = UDPEchoRequestHandler( numberOfWrites: numberOfWrites, remoteAddress: serverChannel.localAddress!, readsCompletePromise: readsCompletePromise ) try channel.pipeline.syncOperations.addHandler(handler) } } .bind(to: address) .wait() // Wait for all echoes to complete try readsCompletePromise.futureResult.wait() // Cleanup try serverChannel.close().wait() try clientChannel.close().wait() } ================================================ FILE: Benchmarks/Benchmarks/NIOPosixBenchmarks/Util/GlobalExecutor.swift ================================================ //===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project // // Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See CONTRIBUTORS.txt for the list of SwiftNIO project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// #if canImport(Darwin) import Darwin.C #elseif canImport(Glibc) import Glibc #else #error("Unsupported platform.") #endif // This file allows us to hook the global executor which // we can use to mimic task executors for now. typealias EnqueueGlobalHook = @convention(thin) (UnownedJob, @convention(thin) (UnownedJob) -> Void) -> Void var swiftTaskEnqueueGlobalHook: EnqueueGlobalHook? { get { _swiftTaskEnqueueGlobalHook.pointee } set { _swiftTaskEnqueueGlobalHook.pointee = newValue } } private let _swiftTaskEnqueueGlobalHook: UnsafeMutablePointer = dlsym(dlopen(nil, RTLD_LAZY), "swift_task_enqueueGlobal_hook").assumingMemoryBound(to: EnqueueGlobalHook?.self) ================================================ FILE: Benchmarks/Package.swift ================================================ // swift-tools-version:5.10 import PackageDescription let package = Package( name: "benchmarks", platforms: [ .macOS("14") ], dependencies: [ .package(path: "../"), .package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.11"), ], targets: [ .executableTarget( name: "NIOPosixBenchmarks", dependencies: [ .product(name: "Benchmark", package: "package-benchmark"), .product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOPosix", package: "swift-nio"), ], path: "Benchmarks/NIOPosixBenchmarks", plugins: [ .plugin(name: "BenchmarkPlugin", package: "package-benchmark") ] ), .executableTarget( name: "NIOCoreBenchmarks", dependencies: [ .product(name: "Benchmark", package: "package-benchmark"), .product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOEmbedded", package: "swift-nio"), ], path: "Benchmarks/NIOCoreBenchmarks", plugins: [ .plugin(name: "BenchmarkPlugin", package: "package-benchmark") ] ), ] ) ================================================ FILE: Benchmarks/Thresholds/5.10/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json ================================================ { "mallocCountTotal" : 8000 } ================================================ FILE: Benchmarks/Thresholds/5.10/NIOCoreBenchmarks.WaitOnPromise.p90.json ================================================ { "mallocCountTotal" : 6000, "memoryLeaked" : 0 } ================================================ FILE: Benchmarks/Thresholds/5.10/NIOPosixBenchmarks.TCPEcho.p90.json ================================================ { "mallocCountTotal" : 108 } ================================================ FILE: Benchmarks/Thresholds/5.10/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ================================================ { "mallocCountTotal" : 164375 } ================================================ FILE: Benchmarks/Thresholds/6.0/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json ================================================ { "mallocCountTotal" : 8000 } ================================================ FILE: Benchmarks/Thresholds/6.0/NIOPosixBenchmarks.TCPEcho.p90.json ================================================ { "mallocCountTotal": 108 } ================================================ FILE: Benchmarks/Thresholds/6.0/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ================================================ { "mallocCountTotal": 82754 } ================================================ FILE: Benchmarks/Thresholds/6.1/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json ================================================ { "mallocCountTotal" : 8000 } ================================================ FILE: Benchmarks/Thresholds/6.1/NIOPosixBenchmarks.TCPEcho.p90.json ================================================ { "mallocCountTotal": 108 } ================================================ FILE: Benchmarks/Thresholds/6.1/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ================================================ { "mallocCountTotal": 82614 } ================================================ FILE: Benchmarks/Thresholds/6.2/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json ================================================ { "mallocCountTotal" : 8000 } ================================================ FILE: Benchmarks/Thresholds/6.2/NIOPosixBenchmarks.TCPEcho.p90.json ================================================ { "mallocCountTotal": 603 } ================================================ FILE: Benchmarks/Thresholds/6.2/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ================================================ { "mallocCountTotal": 387 } ================================================ FILE: Benchmarks/Thresholds/nightly-main/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json ================================================ { "mallocCountTotal" : 8000 } ================================================ FILE: Benchmarks/Thresholds/nightly-main/NIOPosixBenchmarks.TCPEcho.p90.json ================================================ { "mallocCountTotal": 107 } ================================================ FILE: Benchmarks/Thresholds/nightly-main/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ================================================ { "mallocCountTotal": 389 } ================================================ FILE: Benchmarks/Thresholds/nightly-next/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json ================================================ { "mallocCountTotal" : 8000 } ================================================ FILE: Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEcho.p90.json ================================================ { "mallocCountTotal": 108 } ================================================ FILE: Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json ================================================ { "mallocCountTotal": 391 } ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Code of Conduct The code of conduct for this project can be found at https://swift.org/code-of-conduct. ================================================ FILE: CONTRIBUTING.md ================================================ ## Legal By submitting a pull request, you represent that you have the right to license your contribution to Apple and the community, and agree by submitting the patch that your contributions are licensed under the Apache 2.0 license (see `LICENSE.txt`). ## How to submit a bug report Please ensure to specify the following: * SwiftNIO commit hash * Contextual information (e.g. what you were trying to achieve with SwiftNIO) * Simplest possible steps to reproduce * More complex the steps are, lower the priority will be. * A pull request with failing test case is preferred, but it's just fine to paste the test case into the issue description. * Anything that might be relevant in your opinion, such as: * Swift version or the output of `swift --version` * OS version and the output of `uname -a` * Network configuration ### Example ``` SwiftNIO commit hash: 22ec043dc9d24bb011b47ece4f9ee97ee5be2757 Context: While load testing my HTTP web server written with SwiftNIO, I noticed that one file descriptor is leaked per request. Steps to reproduce: 1. ... 2. ... 3. ... 4. ... $ swift --version Swift version 4.0.2 (swift-4.0.2-RELEASE) Target: x86_64-unknown-linux-gnu Operating system: Ubuntu Linux 16.04 64-bit $ uname -a Linux beefy.machine 4.4.0-101-generic #124-Ubuntu SMP Fri Nov 10 18:29:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux My system has IPv6 disabled. ``` ## Writing a Patch A good SwiftNIO patch is: 1. Concise, and contains as few changes as needed to achieve the end result. 2. Tested, ensuring that any tests provided failed before the patch and pass after it. 3. Documented, adding API documentation as needed to cover new functions and properties. 4. Accompanied by a great commit message, using our commit message template. ### Commit Message Template We require that your commit messages match our template. The easiest way to do that is to get git to help you by explicitly using the template. To do that, `cd` to the root of our repository and run: git config commit.template dev/git.commit.template The default policy for taking contributions is “Squash and Merge” - because of this the commit message format rule above applies to the PR rather than every commit contained within it. ### Make sure your patch works for all supported versions of swift The CI will do this for you, but a project maintainer must kick it off for you. Currently all versions of Swift >= 5.9 are supported. If you wish to test this locally use [act](https://github.com/nektos/act). #### Act [Install act](https://nektosact.com/installation/) and then you can run the full suite of checks via: ``` act pull_request ``` Note that SwiftNIO matrix testing makes use of nightly builds, so you may want to make use of the ```--action-offline-mode``` to avoid repulling those. ### Make sure your code is performant SwiftNIO has been created to be high performance. The integration tests cover some measures of performance including allocations which should be avoided if possible. For help with allocation problems refer to the guide to [allocation debugging](./docs/debugging-allocations.md) ### Formatting Try to keep your lines less than 120 characters long so GitHub can correctly display your changes. SwiftNIO uses the [swift-format](https://github.com/swiftlang/swift-format) tool to bring consistency to code formatting. There is a specific [.swift-format](./.swift-format) configuration file. This will be checked and enforced on PRs. Note that the check will run on the current most recent stable version target which may not match that in your own local development environment. If you want to apply the formatting to your local repo before you commit then you can either run [check-swift-format.sh](https://github.com/swiftlang/github-workflows/blob/main/.github/workflows/scripts/check-swift-format.sh) which will use your current toolchain, or to match the CI checks exactly you can use `act` (see [act section](#act)): ``` act --action-offline-mode --bind workflow_call --job soundness --input format_check_enabled=true ``` If you're using a machine with an ARM64 architecture (such as an Apple Silicon Mac) then you'll also need to specify the container architecture: ``` act --container-architecture linux/amd64 --action-offline-mode --bind workflow_call --job soundness --input format_check_enabled=true ``` This will run the format checks, binding to your local checkout so the edits made are to your own source. ### Extensibility Try to make sure your code is robust to future extensions. The public interface is very hard to change after release - please refer to the [API guidelines](./docs/public-api.md) ## How to contribute your work Please open a pull request at https://github.com/apple/swift-nio. Make sure the CI passes, and then wait for code review. After review you may be asked to make changes. When you are ready, use the request re-review feature of GitHub or mention the reviewers by name in a comment. ================================================ FILE: CONTRIBUTORS.txt ================================================ For the purpose of tracking copyright, this is the list of individuals and organizations who have contributed source code to SwiftNIO. For employees of an organization/company where the copyright of work done by employees of that company is held by the company itself, only the company needs to be listed here. ## COPYRIGHT HOLDERS - Apple Inc. (all contributors with '@apple.com') ### Contributors - 0xflotus <0xflotus@gmail.com> - Adam Fowler - Adam Nemecek - Ahmad Alhashemi - Albert Aleksieiev - Alex Blewitt - Alex Reilly - Andrew Edwards - Andrew Naylor - Andrew Trick - Andrius Aucinas - Anish Aggarwal - Ankit Aggarwal - Antoine Cœur - Antwan van Houdt - Arjun Nayini - Artem Redkin - Austin Payne - Bas Broek - Bastian Inuk Christensen - Ben Cohen - Benedict St. - Boby <73424060+bobychaudhary@users.noreply.github.com> - Bouke Haarsma - Chris Eidhof - Christian Priebe - Christian Weinberger - Cory Benfield - Cotton Hou - Damiaan Dufaux - Daniel Alm - Daniel Dunbar - Dario Rexin - David Evans - David Nadoba - David Skrundz - Donghyeon Kim - Doug Friedman - Emil Marashliev - Esteban Torres - Eugen - Fabian Fett - Felix Schlegel - Felix Schlegel - Finagolfin - Florian Friedrich - Frank Kair - Franz Busch - Gautier Delorme - George Barnett - Gopal Sharma - Graeme Jenkinson - Gregor Milos (Grzegorz Miłoś) - GuangGuang - Guillaume Lessard - Gwynne Raskind - Hailong - Heidi Puk Hermann - Helder Sérvio <41337686+heldersrvio@users.noreply.github.com> - Helge Heß - Ian Partridge - Ilya Puchka - JP Simard - Jake Foster - Jake Prickett - Jari (LotU) - Jason Toffaletti - Jim Dovey - Joachim M. - Joakim Hassila - Joe Smith - Johannes Weiss - John Connolly - John Holdsworth - John Lin - Joshua Rutkowski - Jovan Milenkovic - Julian Lettner - Kaitlin Mahar - Kamil Borzym - Karim ElNaggar - Kevin Clark - Kevin Sweeney - Kim de Vos - Konrad `ktoso` Malawski - Kushal Pisavadia - Kyle Bashour - Kyle Browning - Kyle Jessup - Lev Walkin - Liam Flynn - Ludovic Dewailly - Luo Xiu - Mahdi Bahrami - Marcus Liotta - Mario Sangiorgio - Markus Jais - Markus Kieselmann - Marli Oshlack - Matt Eaton - Matt Hope - Matteo Comisso - Max Desiatov - Max Desiatov - Max Moiseev - Maxim Zaks - Moritz Lang - Nathan Harris - Nethra Ravindran - Norio Nomura - Norman Maurer - Ole Begemann - OleG - Oleksandr Zhurba <69315809+mob-connection@users.noreply.github.com> - Paul Schmiedmayer - Peter Adams - Peter Tolsma - Petro Rovenskyy - Philip Brown <122590765+asdf-bro@users.noreply.github.com> - Portia - Pushkar N Kulkarni - Pushparaj Zala - Richard Low - Rick Newton-Rogers - Romain Pouclet - Rukshani Athapathu - Rémi Doreau - Saleem Abdulrasool - Sebastian Thiebaud <770074+SebastianThiebaud@users.noreply.github.com> - Sebastian Vogt - Semen Zhydenko - Sergej Jaskiewicz - Sergo Beruashvili - Shaun Hubbard - Shekhar Rajak - Si Beaumont - Siemen Sikkema - Simon Evans - Stepan Ulyanin - Stuart Hinson - Tanner - Tiago Martinho - Tibor Bödecs - Tim Condon <0xtimc@gmail.com> - Tim Kientzle - Timothée Peignier - Tom Counsell - Tomer Doron - Tony Arnold - Trevör - Trevör Anne Denise - Volodymyr Sapsai - Will Lisac - Wilson Ding - YR Chen - Yim Lee - akash-55 <61596874+akash-55@users.noreply.github.com> - buttaface - carolinacass <67160898+carolinacass@users.noreply.github.com> - dkz2 <132388278+dkz2@users.noreply.github.com> - fadi-botros - jemmons - pokryfka - ser <122270051+ser-0xff@users.noreply.github.com> - sun_ - taylorswift - thomas-gill-0xff <115996764+thomas-gill-0xff@users.noreply.github.com> - toluRV <111301355+toluRV@users.noreply.github.com> - trungducc **Updating this list** Please do not edit this file manually. It is generated using `./scripts/generate_contributors_list.sh`. If a name is misspelled or appearing multiple times: add an entry in `./.mailmap` ================================================ FILE: IntegrationTests/allocation-counter-tests-framework/run-allocation-counter.sh ================================================ #!/bin/bash ##===----------------------------------------------------------------------===## ## ## This source file is part of the SwiftNIO open source project ## ## Copyright (c) 2019-2020 Apple Inc. and the SwiftNIO project authors ## Licensed under Apache License v2.0 ## ## See LICENSE.txt for license information ## See CONTRIBUTORS.txt for the list of SwiftNIO project authors ## ## SPDX-License-Identifier: Apache-2.0 ## ##===----------------------------------------------------------------------===## set -eu here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" build_opts=( -c release ) function die() { echo >&2 "ERROR: $*" exit 1 } function make_git_commit_all() { git init > /dev/null git checkout -b main > /dev/null if [[ "$(git config user.email)" == "" ]]; then git config --local user.email does@really-not.matter git config --local user.name 'Does Not Matter' fi git add . > /dev/null git commit -m 'everything' > /dev/null } # function hooked_package_swift_start() { local extra_dependencies_file=$1 local swiftpm_pkg_name=$2 shift 2 cat <<"EOF" // swift-tools-version:5.7 import PackageDescription let package = Package( name: "allocation-counter-tests", platforms: [ .macOS(.v10_15), .iOS(.v13), .watchOS(.v6), .tvOS(.v13), ], products: [ EOF for f in "$@"; do local module module=$(module_name_from_path "$f") echo ".executable(name: \"$module\", targets: [\"bootstrap_$module\"])," done cat < function hooked_package_swift_target() { local target_name="$1" shift local deps="" for dep in "$@"; do deps="$deps .product(name: \"$dep\", package: \"swift-nio\")," done cat < Package.swift <