Skip to content

Commit 5fee508

Browse files
shahmishaleuanhMaxDesiatov
authored
CI: Add support for GitHub Actions (#199)
* [CI] Add support for GitHub Actions * Add locales locales-all libsqlite3-dev to the GitHub Actions * workflows: Disable tests; concentrate on fixing errors in soundness * workflows: Remove soundness.sh, which now comes from github-workflows Ironically, Utilities/soundness.sh fails the shellcheck soundness check. * workflows: Fix yamllint formatting * workflows: Exempt vendored code from swift format checks * workflows: Exempt ProcessExecutor and its tests from unacceptable language check "kill" in these files refers to a Unix command and signal and cannot be avoided. * Update .github/workflows/pull_request.yml * Unify license headers * Update `license_header_check_project_name` in workflow * Use `.license_header_template` * Fix most of the license checks * Update .licenseignore * Fix `.licenseignore` * workflows: Fix multiline string formatting for swift-format * workflows: Allow swift-format to fix whitespace * workflows: Snapshot default swift-format settings The .swift-format settings file was generated by: swift format dump-configuration > .swift-format We will need to configure or turn off some checks; this allows us to keep track of what settings we have changed. * workflows: Disable invasive swift-format checks swift format complains about some long-standing choices in this repository. For now we will disable these specific complaints. * workflows: Remove soundness check from CI compose files --------- Co-authored-by: Euan Harris <[email protected]> Co-authored-by: Max Desiatov <[email protected]>
1 parent df46d2f commit 5fee508

File tree

54 files changed

+1056
-852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1056
-852
lines changed

.github/workflows/pull_request.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Pull request
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
# tests:
9+
# name: Test
10+
# uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
11+
# with:
12+
# linux_pre_build_command: apt-get update && apt-get install -y locales locales-all libsqlite3-dev
13+
soundness:
14+
name: Soundness
15+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
16+
with:
17+
api_breakage_check_enabled: false

.license_header_template

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@@===----------------------------------------------------------------------===@@
2+
@@
3+
@@ This source file is part of the Swift open source project
4+
@@
5+
@@ Copyright (c) YEARS Apple Inc. and the Swift project authors
6+
@@ Licensed under Apache License v2.0 with Runtime Library Exception
7+
@@
8+
@@ See https://swift.org/LICENSE.txt for license information
9+
@@ See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
@@
11+
@@===----------------------------------------------------------------------===@@
12+

.licenseignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.gitignore
2+
.swiftformat
3+
.swiftformatignore
4+
.editorconfig
5+
.unacceptablelanguageignore
6+
Brewfile
7+
Package.swift
8+
Package.resolved
9+
*.md
10+
*.txt
11+
*.yml
12+
**/.editorconfig
13+
**/*.docc/**
14+
**/*.entitlements
15+
**/*.input
16+
**/*.modulemap
17+
**/*.plist
18+
**/*.xcodeproj/**
19+
**/CODEOWNERS
20+
**/Dockerfile
21+
**/Package.swift
22+
Utilities/git.commit.template

.swift-format

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentConditionalCompilationBlocks" : true,
6+
"indentSwitchCaseLabels" : false,
7+
"indentation" : {
8+
"spaces" : 2
9+
},
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineLength" : 100,
15+
"maximumBlankLines" : 1,
16+
"multiElementCollectionTrailingCommas" : true,
17+
"noAssignmentInExpressions" : {
18+
"allowedFunctions" : [
19+
"XCTAssertNoThrow"
20+
]
21+
},
22+
"prioritizeKeepingFunctionOutputTogether" : false,
23+
"respectsExistingLineBreaks" : true,
24+
"rules" : {
25+
"AllPublicDeclarationsHaveDocumentation" : false,
26+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
27+
"AlwaysUseLowerCamelCase" : false,
28+
"AmbiguousTrailingClosureOverload" : true,
29+
"BeginDocumentationCommentWithOneLineSummary" : false,
30+
"DoNotUseSemicolons" : true,
31+
"DontRepeatTypeInStaticProperties" : true,
32+
"FileScopedDeclarationPrivacy" : true,
33+
"FullyIndirectEnum" : true,
34+
"GroupNumericLiterals" : true,
35+
"IdentifiersMustBeASCII" : true,
36+
"NeverForceUnwrap" : false,
37+
"NeverUseForceTry" : false,
38+
"NeverUseImplicitlyUnwrappedOptionals" : false,
39+
"NoAccessLevelOnExtensionDeclaration" : true,
40+
"NoAssignmentInExpressions" : true,
41+
"NoBlockComments" : true,
42+
"NoCasesWithOnlyFallthrough" : true,
43+
"NoEmptyTrailingClosureParentheses" : true,
44+
"NoLabelsInCasePatterns" : true,
45+
"NoLeadingUnderscores" : false,
46+
"NoParensAroundConditions" : true,
47+
"NoPlaygroundLiterals" : true,
48+
"NoVoidReturnOnFunctionSignature" : true,
49+
"OmitExplicitReturns" : false,
50+
"OneCasePerLine" : true,
51+
"OneVariableDeclarationPerLine" : true,
52+
"OnlyOneTrailingClosureArgument" : true,
53+
"OrderedImports" : true,
54+
"ReplaceForEachWithForLoop" : true,
55+
"ReturnVoidInsteadOfEmptyTuple" : true,
56+
"TypeNamesShouldBeCapitalized" : true,
57+
"UseEarlyExits" : false,
58+
"UseExplicitNilCheckInConditions" : true,
59+
"UseLetInEveryBoundCaseVariable" : false,
60+
"UseShorthandTypeNames" : true,
61+
"UseSingleLinePropertyGetter" : true,
62+
"UseSynthesizedInitializer" : true,
63+
"UseTripleSlashForDocumentationComments" : true,
64+
"UseWhereClausesInForLoops" : false,
65+
"ValidateDocumentationComments" : false
66+
},
67+
"spacesAroundRangeFormationOperators" : false,
68+
"tabWidth" : 8,
69+
"version" : 1
70+
}

.swiftformatignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Sources/Helpers/Vendor/*
2+
Sources/AsyncProcess/ProcessExecutor.swift

.unacceptablelanguageignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Sources/AsyncProcess/ProcessExecutor.swift
2+
Tests/AsyncProcessTests/IntegrationTests.swift

Docker/docker-compose.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ services:
1919
- ..:/code:z
2020
working_dir: /code
2121

22-
soundness:
23-
<<: *common
24-
command: /bin/bash -xcl "swift -version && uname -a && ./Utilities/soundness.sh"
25-
2622
test:
2723
<<: *common
2824
environment:

Package.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
.executable(
1212
name: "swift-sdk-generator",
1313
targets: ["GeneratorCLI"]
14-
),
14+
)
1515
],
1616
targets: [
1717
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -23,7 +23,7 @@ let package = Package(
2323
.product(name: "ArgumentParser", package: "swift-argument-parser"),
2424
],
2525
swiftSettings: [
26-
.enableExperimentalFeature("StrictConcurrency=complete"),
26+
.enableExperimentalFeature("StrictConcurrency=complete")
2727
]
2828
),
2929
.target(
@@ -38,22 +38,22 @@ let package = Package(
3838
],
3939
exclude: ["Dockerfiles"],
4040
swiftSettings: [
41-
.enableExperimentalFeature("StrictConcurrency=complete"),
41+
.enableExperimentalFeature("StrictConcurrency=complete")
4242
]
4343
),
4444
.testTarget(
4545
name: "SwiftSDKGeneratorTests",
4646
dependencies: [
47-
"SwiftSDKGenerator",
47+
"SwiftSDKGenerator"
4848
],
4949
swiftSettings: [
50-
.enableExperimentalFeature("StrictConcurrency=complete"),
50+
.enableExperimentalFeature("StrictConcurrency=complete")
5151
]
5252
),
5353
.testTarget(
5454
name: "GeneratorEngineTests",
5555
dependencies: [
56-
"Helpers",
56+
"Helpers"
5757
]
5858
),
5959
.target(
@@ -66,13 +66,13 @@ let package = Package(
6666
],
6767
exclude: ["Vendor/README.md"],
6868
swiftSettings: [
69-
.enableExperimentalFeature("StrictConcurrency=complete"),
69+
.enableExperimentalFeature("StrictConcurrency=complete")
7070
]
7171
),
7272
.testTarget(
7373
name: "HelpersTests",
7474
dependencies: [
75-
"Helpers",
75+
"Helpers"
7676
]
7777
),
7878
.systemLibrary(name: "SystemSQLite", pkgConfig: "sqlite3"),

Sources/AsyncProcess/ChunkSequence.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import NIO
1414

1515
#if os(Linux) || os(Android) || os(Windows)
16-
@preconcurrency import Foundation
16+
@preconcurrency import Foundation
1717
#else
18-
import Foundation
18+
import Foundation
1919
#endif
2020

2121
public struct IllegalStreamConsumptionError: Error {
@@ -53,9 +53,9 @@ public struct ChunkSequence: AsyncSequence & Sendable {
5353
} else {
5454
throw IllegalStreamConsumptionError(
5555
description: """
56-
Either `.discard`ed, `.inherit`ed or redirected this stream to a `.fileHandle`,
57-
cannot also consume it. To consume, please `.stream` it.
58-
"""
56+
Either `.discard`ed, `.inherit`ed or redirected this stream to a `.fileHandle`,
57+
cannot also consume it. To consume, please `.stream` it.
58+
"""
5959
)
6060
}
6161
}

Sources/AsyncProcess/FileContentStream.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ private final class ReadIntoAsyncChannelHandler: ChannelDuplexHandler {
255255

256256
extension FileHandle {
257257
func fileContentStream(eventLoop: EventLoop) throws -> FileContentStream {
258-
let asyncBytes = try FileContentStream(fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
258+
let asyncBytes = try FileContentStream(
259+
fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
259260
try self.close()
260261
return asyncBytes
261262
}
@@ -272,8 +273,8 @@ extension FileContentStream {
272273
}
273274
}
274275

275-
public extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
276-
func splitIntoLines(
276+
extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
277+
public func splitIntoLines(
277278
dropTerminator: Bool = true,
278279
maximumAllowableBufferSize: Int = 1024 * 1024,
279280
dropLastChunkIfNoNewline: Bool = false
@@ -286,14 +287,13 @@ public extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
286287
)
287288
}
288289

289-
var strings: AsyncMapSequence<Self, String> {
290+
public var strings: AsyncMapSequence<Self, String> {
290291
self.map { String(buffer: $0) }
291292
}
292293
}
293294

294295
public struct AsyncByteBufferLineSequence<Base: Sendable>: AsyncSequence & Sendable
295-
where Base: AsyncSequence, Base.Element == ByteBuffer
296-
{
296+
where Base: AsyncSequence, Base.Element == ByteBuffer {
297297
public typealias Element = ByteBuffer
298298
private let underlying: Base
299299
private let dropTerminator: Bool
@@ -329,7 +329,9 @@ public struct AsyncByteBufferLineSequence<Base: Sendable>: AsyncSequence & Senda
329329
self.buffer.last?.readableBytesView
330330
}
331331

332-
mutating func concatenateEverything(upToLastChunkLengthToConsume lastLength: Int) -> ByteBuffer {
332+
mutating func concatenateEverything(upToLastChunkLengthToConsume lastLength: Int)
333+
-> ByteBuffer
334+
{
333335
var output = ByteBuffer()
334336
output.reserveCapacity(lastLength + self.byteCountButLast)
335337

0 commit comments

Comments
 (0)