Skip to content

Commit f70b838

Browse files
authored
[CI] Adopt GitHub actions (#187)
# Motivation We want to switch our CI to GitHub actions. # Modification This PR sets up the reusable workflows from NIO. # Result More modern CI.
1 parent 24c800f commit f70b838

30 files changed

+464
-508
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
11+
[*.yml]
12+
indent_style = space
13+
indent_size = 2

.github/release.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
categories:
3+
- title: SemVer Major
4+
labels:
5+
- ⚠️ semver/major
6+
- title: SemVer Minor
7+
labels:
8+
- semver/minor
9+
- title: SemVer Patch
10+
labels:
11+
- semver/patch
12+
- title: Other Changes
13+
labels:
14+
- semver/none

.github/workflows/main.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 8,20 * * *"
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit tests
12+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
13+
with:
14+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
15+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
16+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
17+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
18+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
19+
20+
cxx-interop:
21+
name: Cxx interop
22+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main

.github/workflows/pull_request.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
soundness:
9+
name: Soundness
10+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
11+
with:
12+
license_header_check_project_name: "SwiftServiceLifecycle"
13+
14+
unit-tests:
15+
name: Unit tests
16+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
17+
with:
18+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
19+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
20+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
21+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
22+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
23+
24+
cxx-interop:
25+
name: Cxx interop
26+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, reopened, synchronize]
6+
7+
jobs:
8+
semver-label-check:
9+
name: Semantic Version label check
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 1
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
- name: Check for Semantic Version label
18+
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main

.licenseignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.gitignore
2+
**/.gitignore
3+
.licenseignore
4+
.gitattributes
5+
.mailfilter
6+
.mailmap
7+
.spi.yml
8+
.swift-format
9+
.editorconfig
10+
.github/*
11+
*.md
12+
*.txt
13+
*.yml
14+
*.yaml
15+
*.json
16+
Package.swift
17+
**/Package.swift
18+
Package@-*.swift
19+
**/Package@-*.swift
20+
Package.resolved
21+
**/Package.resolved
22+
Makefile
23+
*.modulemap
24+
**/*.modulemap
25+
**/*.docc/*
26+
*.xcprivacy
27+
**/*.xcprivacy
28+
*.symlink
29+
**/*.symlink
30+
Dockerfile
31+
**/Dockerfile
32+
Snippets/*
33+
dev/git.commit.template
34+
*.crt
35+
**/*.crt
36+
*.pem
37+
**/*.pem
38+
*.der
39+
**/*.der

.swift-format

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

.swiftformat

-27
This file was deleted.

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Package.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ let package = Package(
2828
url: "https://github.com/apple/swift-log.git",
2929
from: "1.5.2"
3030
),
31-
.package(
32-
url: "https://github.com/apple/swift-docc-plugin",
33-
from: "1.0.0"
34-
),
3531
.package(
3632
url: "https://github.com/apple/swift-async-algorithms.git",
3733
from: "1.0.0"
@@ -56,13 +52,13 @@ let package = Package(
5652
.target(
5753
name: "ServiceLifecycleTestKit",
5854
dependencies: [
59-
.target(name: "ServiceLifecycle"),
55+
.target(name: "ServiceLifecycle")
6056
]
6157
),
6258
.target(
6359
name: "UnixSignals",
6460
dependencies: [
65-
.target(name: "ConcurrencyHelpers"),
61+
.target(name: "ConcurrencyHelpers")
6662
]
6763
),
6864
.target(
@@ -78,8 +74,12 @@ let package = Package(
7874
.testTarget(
7975
name: "UnixSignalsTests",
8076
dependencies: [
81-
.target(name: "UnixSignals"),
77+
.target(name: "UnixSignals")
8278
]
8379
),
8480
]
8581
)
82+
83+
for target in package.targets {
84+
target.swiftSettings?.append(.enableUpcomingFeature("StrictConcurrency"))
85+
}

Sources/ConcurrencyHelpers/Lock.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ final class LockStorage<Value>: ManagedBuffer<Value, LockPrimitive> {
184184
}
185185
}
186186

187-
extension LockStorage: @unchecked Sendable {}
188-
189187
/// A threading lock based on `libpthread` instead of `libdispatch`.
190188
///
191189
/// - note: ``Lock`` has reference semantics.
@@ -252,7 +250,7 @@ extension Lock {
252250
}
253251
}
254252

255-
extension Lock: Sendable {}
253+
extension Lock: @unchecked Sendable {}
256254

257255
extension UnsafeMutablePointer {
258256
@inlinable

Sources/ConcurrencyHelpers/LockedValueBox.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ public struct LockedValueBox<Value> {
5151
}
5252
}
5353

54-
extension LockedValueBox: Sendable where Value: Sendable {}
54+
extension LockedValueBox: @unchecked Sendable where Value: Sendable {}

Sources/ServiceLifecycle/AsyncCancelOnGracefulShutdownSequence.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ extension AsyncSequence where Self: Sendable, Element: Sendable {
2424
}
2525

2626
/// An asynchronous sequence that is cancelled once graceful shutdown has triggered.
27-
public struct AsyncCancelOnGracefulShutdownSequence<Base: AsyncSequence & Sendable>: AsyncSequence, Sendable where Base.Element: Sendable {
27+
public struct AsyncCancelOnGracefulShutdownSequence<Base: AsyncSequence & Sendable>: AsyncSequence, Sendable
28+
where Base.Element: Sendable {
2829
@usableFromInline
2930
enum _ElementOrGracefulShutdown: Sendable {
3031
case base(AsyncMapNilSequence<Base>.Element)

0 commit comments

Comments
 (0)