Skip to content

Commit

Permalink
[CI] Adopt GitHub actions
Browse files Browse the repository at this point in the history
# Motivation

We want to switch our CI to GitHub actions.

# Modification

This PR sets up the reusable workflows from NIO.

# Result

More modern CI.
  • Loading branch information
FranzBusch committed Oct 30, 2024
1 parent 24c800f commit 70df18d
Show file tree
Hide file tree
Showing 30 changed files with 427 additions and 510 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true


[*.yml]
indent_style = space
indent_size = 2
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Main

on:
push:
branches: [main]
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
26 changes: 26 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR

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

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "SwiftServiceLifecycle"

unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
18 changes: 18 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR label

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@v4
with:
persist-credentials: false
- name: Check for Semantic Version label
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main
39 changes: 39 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.gitignore
**/.gitignore
.licenseignore
.gitattributes
.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/*
dev/git.commit.template
*.crt
**/*.crt
*.pem
**/*.pem
*.der
**/*.der
58 changes: 58 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"indentation" : {
"spaces" : 4
},
"indentConditionalCompilationBlocks" : false,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : true,
"lineBreakBeforeEachGenericRequirement" : true,
"lineLength" : 120,
"maximumBlankLines" : 1,
"prioritizeKeepingFunctionOutputTogether" : true,
"respectsExistingLineBreaks" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : 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" : false,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : false,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : true,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : false,
"UseSynthesizedInitializer" : false,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
},
"spacesAroundRangeFormationOperators" : false,
"tabWidth" : 4,
"version" : 1
}
27 changes: 0 additions & 27 deletions .swiftformat

This file was deleted.

1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
14 changes: 7 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ let package = Package(
url: "https://github.com/apple/swift-log.git",
from: "1.5.2"
),
.package(
url: "https://github.com/apple/swift-docc-plugin",
from: "1.0.0"
),
.package(
url: "https://github.com/apple/swift-async-algorithms.git",
from: "1.0.0"
Expand All @@ -56,13 +52,13 @@ let package = Package(
.target(
name: "ServiceLifecycleTestKit",
dependencies: [
.target(name: "ServiceLifecycle"),
.target(name: "ServiceLifecycle")
]
),
.target(
name: "UnixSignals",
dependencies: [
.target(name: "ConcurrencyHelpers"),
.target(name: "ConcurrencyHelpers")
]
),
.target(
Expand All @@ -78,8 +74,12 @@ let package = Package(
.testTarget(
name: "UnixSignalsTests",
dependencies: [
.target(name: "UnixSignals"),
.target(name: "UnixSignals")
]
),
]
)

for target in package.targets {
target.swiftSettings?.append(.enableUpcomingFeature("StrictConcurrency"))
}
4 changes: 1 addition & 3 deletions Sources/ConcurrencyHelpers/Lock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ final class LockStorage<Value>: ManagedBuffer<Value, LockPrimitive> {
}
}

extension LockStorage: @unchecked Sendable {}

/// A threading lock based on `libpthread` instead of `libdispatch`.
///
/// - note: ``Lock`` has reference semantics.
Expand Down Expand Up @@ -252,7 +250,7 @@ extension Lock {
}
}

extension Lock: Sendable {}
extension Lock: @unchecked Sendable {}

extension UnsafeMutablePointer {
@inlinable
Expand Down
2 changes: 1 addition & 1 deletion Sources/ConcurrencyHelpers/LockedValueBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public struct LockedValueBox<Value> {
}
}

extension LockedValueBox: Sendable where Value: Sendable {}
extension LockedValueBox: @unchecked Sendable where Value: Sendable {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ extension AsyncSequence where Self: Sendable, Element: Sendable {
}

/// An asynchronous sequence that is cancelled once graceful shutdown has triggered.
public struct AsyncCancelOnGracefulShutdownSequence<Base: AsyncSequence & Sendable>: AsyncSequence, Sendable where Base.Element: Sendable {
public struct AsyncCancelOnGracefulShutdownSequence<Base: AsyncSequence & Sendable>: AsyncSequence, Sendable
where Base.Element: Sendable {
@usableFromInline
enum _ElementOrGracefulShutdown: Sendable {
case base(AsyncMapNilSequence<Base>.Element)
Expand Down
Loading

0 comments on commit 70df18d

Please sign in to comment.