Skip to content

CI: Add support for GitHub Actions #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull request

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
# tests:
# name: Test
# uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
# with:
# linux_pre_build_command: apt-get update && apt-get install -y locales locales-all libsqlite3-dev
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
api_breakage_check_enabled: false
12 changes: 12 additions & 0 deletions .license_header_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@@===----------------------------------------------------------------------===@@
@@
@@ This source file is part of the Swift open source project
@@
@@ Copyright (c) YEARS Apple Inc. and the Swift project authors
@@ Licensed under Apache License v2.0 with Runtime Library Exception
@@
@@ See https://swift.org/LICENSE.txt for license information
@@ See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
@@
@@===----------------------------------------------------------------------===@@

22 changes: 22 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.gitignore
.swiftformat
.swiftformatignore
.editorconfig
.unacceptablelanguageignore
Brewfile
Package.swift
Package.resolved
*.md
*.txt
*.yml
**/.editorconfig
**/*.docc/**
**/*.entitlements
**/*.input
**/*.modulemap
**/*.plist
**/*.xcodeproj/**
**/CODEOWNERS
**/Dockerfile
**/Package.swift
Utilities/git.commit.template
70 changes: 70 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"indentConditionalCompilationBlocks" : true,
"indentSwitchCaseLabels" : false,
"indentation" : {
"spaces" : 2
},
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : false,
"lineBreakBeforeEachGenericRequirement" : false,
"lineLength" : 100,
"maximumBlankLines" : 1,
"multiElementCollectionTrailingCommas" : true,
"noAssignmentInExpressions" : {
"allowedFunctions" : [
"XCTAssertNoThrow"
]
},
"prioritizeKeepingFunctionOutputTogether" : false,
"respectsExistingLineBreaks" : 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,
"NoPlaygroundLiterals" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OmitExplicitReturns" : false,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : true,
"ReplaceForEachWithForLoop" : true,
"ReturnVoidInsteadOfEmptyTuple" : true,
"TypeNamesShouldBeCapitalized" : true,
"UseEarlyExits" : false,
"UseExplicitNilCheckInConditions" : true,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : true,
"UseSynthesizedInitializer" : true,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
},
"spacesAroundRangeFormationOperators" : false,
"tabWidth" : 8,
"version" : 1
}
2 changes: 2 additions & 0 deletions .swiftformatignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sources/Helpers/Vendor/*
Sources/AsyncProcess/ProcessExecutor.swift
2 changes: 2 additions & 0 deletions .unacceptablelanguageignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sources/AsyncProcess/ProcessExecutor.swift
Tests/AsyncProcessTests/IntegrationTests.swift
4 changes: 0 additions & 4 deletions Docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ services:
- ..:/code:z
working_dir: /code

soundness:
<<: *common
command: /bin/bash -xcl "swift -version && uname -a && ./Utilities/soundness.sh"

test:
<<: *common
environment:
Expand Down
16 changes: 8 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
.executable(
name: "swift-sdk-generator",
targets: ["GeneratorCLI"]
),
)
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -23,7 +23,7 @@ let package = Package(
.product(name: "ArgumentParser", package: "swift-argument-parser"),
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
.enableExperimentalFeature("StrictConcurrency=complete")
]
),
.target(
Expand All @@ -38,22 +38,22 @@ let package = Package(
],
exclude: ["Dockerfiles"],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
.enableExperimentalFeature("StrictConcurrency=complete")
]
),
.testTarget(
name: "SwiftSDKGeneratorTests",
dependencies: [
"SwiftSDKGenerator",
"SwiftSDKGenerator"
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
.enableExperimentalFeature("StrictConcurrency=complete")
]
),
.testTarget(
name: "GeneratorEngineTests",
dependencies: [
"Helpers",
"Helpers"
]
),
.target(
Expand All @@ -66,13 +66,13 @@ let package = Package(
],
exclude: ["Vendor/README.md"],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
.enableExperimentalFeature("StrictConcurrency=complete")
]
),
.testTarget(
name: "HelpersTests",
dependencies: [
"Helpers",
"Helpers"
]
),
.systemLibrary(name: "SystemSQLite", pkgConfig: "sqlite3"),
Expand Down
10 changes: 5 additions & 5 deletions Sources/AsyncProcess/ChunkSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import NIO

#if os(Linux) || os(Android) || os(Windows)
@preconcurrency import Foundation
@preconcurrency import Foundation
#else
import Foundation
import Foundation
#endif

public struct IllegalStreamConsumptionError: Error {
Expand Down Expand Up @@ -53,9 +53,9 @@ public struct ChunkSequence: AsyncSequence & Sendable {
} else {
throw IllegalStreamConsumptionError(
description: """
Either `.discard`ed, `.inherit`ed or redirected this stream to a `.fileHandle`,
cannot also consume it. To consume, please `.stream` it.
"""
Either `.discard`ed, `.inherit`ed or redirected this stream to a `.fileHandle`,
cannot also consume it. To consume, please `.stream` it.
"""
)
}
}
Expand Down
16 changes: 9 additions & 7 deletions Sources/AsyncProcess/FileContentStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ private final class ReadIntoAsyncChannelHandler: ChannelDuplexHandler {

extension FileHandle {
func fileContentStream(eventLoop: EventLoop) throws -> FileContentStream {
let asyncBytes = try FileContentStream(fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
let asyncBytes = try FileContentStream(
fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
try self.close()
return asyncBytes
}
Expand All @@ -272,8 +273,8 @@ extension FileContentStream {
}
}

public extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
func splitIntoLines(
extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
public func splitIntoLines(
dropTerminator: Bool = true,
maximumAllowableBufferSize: Int = 1024 * 1024,
dropLastChunkIfNoNewline: Bool = false
Expand All @@ -286,14 +287,13 @@ public extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
)
}

var strings: AsyncMapSequence<Self, String> {
public var strings: AsyncMapSequence<Self, String> {
self.map { String(buffer: $0) }
}
}

public struct AsyncByteBufferLineSequence<Base: Sendable>: AsyncSequence & Sendable
where Base: AsyncSequence, Base.Element == ByteBuffer
{
where Base: AsyncSequence, Base.Element == ByteBuffer {
public typealias Element = ByteBuffer
private let underlying: Base
private let dropTerminator: Bool
Expand Down Expand Up @@ -329,7 +329,9 @@ public struct AsyncByteBufferLineSequence<Base: Sendable>: AsyncSequence & Senda
self.buffer.last?.readableBytesView
}

mutating func concatenateEverything(upToLastChunkLengthToConsume lastLength: Int) -> ByteBuffer {
mutating func concatenateEverything(upToLastChunkLengthToConsume lastLength: Int)
-> ByteBuffer
{
var output = ByteBuffer()
output.reserveCapacity(lastLength + self.byteCountButLast)

Expand Down
Loading