-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate CI to use GitHub Actions. Motivation: To migrate to GitHub actions and centralised infrastructure. Modifications: Changes of note: * Raise minimum Swift version to 5.9 * Migrate benchmarks from swift-distributed-tracing and adopt package-benchmark * Adopt swift-format using rules from SwiftNIO * Remove scripts and docker files which are no longer needed Result: GitHub Actions CI in parity with old CI plus benchmarks CI.
- Loading branch information
Showing
48 changed files
with
511 additions
and
618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
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 -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" | ||
|
||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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: "Swift Service Context" | ||
|
||
unit-tests: | ||
name: Unit tests | ||
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main | ||
with: | ||
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
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 -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" | ||
|
||
benchmarks: | ||
name: Benchmarks | ||
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main | ||
with: | ||
benchmark_package_path: "Benchmarks" | ||
|
||
cxx-interop: | ||
name: Cxx interop | ||
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main | ||
|
||
swift-6-language-mode: | ||
name: Swift 6 Language Mode | ||
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main | ||
if: false # Disabled for now. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.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/* | ||
dev/git.commit.template | ||
.unacceptablelanguageignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"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, | ||
"noAssignmentInExpressions" : { | ||
"allowedFunctions" : [ | ||
"XCTAssertNoThrow", | ||
"XCTAssertThrowsError" | ||
] | ||
}, | ||
"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 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.build/ |
49 changes: 49 additions & 0 deletions
49
Benchmarks/Benchmarks/ServiceContextBenchmarks/Benchmarks.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Service Context open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the Swift Service Context project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of Swift Service Context project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
|
||
let benchmarks = { | ||
let defaultMetrics: [BenchmarkMetric] = [ | ||
.mallocCountTotal | ||
] | ||
|
||
Benchmark( | ||
"PassAroundStaticStringsSmall", | ||
configuration: .init( | ||
metrics: defaultMetrics, | ||
scalingFactor: .mega, | ||
maxDuration: .seconds(10_000_000), | ||
maxIterations: 10 | ||
) | ||
) { benchmark in | ||
runPassAroundStaticStringsSmall( | ||
iterations: benchmark.scaledIterations.upperBound | ||
) | ||
} | ||
|
||
Benchmark( | ||
"PassAroundStaticStringsLarge", | ||
configuration: .init( | ||
metrics: defaultMetrics, | ||
scalingFactor: .mega, | ||
maxDuration: .seconds(10_000_000), | ||
maxIterations: 10 | ||
) | ||
) { benchmark in | ||
runPassAroundStaticStringsLarge( | ||
iterations: benchmark.scaledIterations.upperBound | ||
) | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
Benchmarks/Benchmarks/ServiceContextBenchmarks/PassAroundStaticStrings.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Service Context open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the Swift Service Context project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of Swift Service Context project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Distributed Tracing open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the Swift Distributed Tracing project | ||
// authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
import ServiceContextModule | ||
|
||
func runPassAroundStaticStringsSmall(iterations: Int) { | ||
var context = ServiceContext.topLevel | ||
// static allocated strings | ||
context[StringKey1.self] = "one" | ||
context[StringKey2.self] = "two" | ||
context[StringKey3.self] = "three" | ||
|
||
for _ in 0..<iterations { | ||
let res = take1(context: context) | ||
precondition(res == 42) | ||
} | ||
} | ||
|
||
func runPassAroundStaticStringsLarge(iterations: Int) { | ||
var context = ServiceContext.topLevel | ||
// static allocated strings | ||
context[StringKey1.self] = String(repeating: "a", count: 30) | ||
context[StringKey2.self] = String(repeating: "b", count: 12) | ||
context[StringKey3.self] = String(repeating: "c", count: 20) | ||
|
||
for _ in 0..<iterations { | ||
let res = take1(context: context) | ||
precondition(res == 42) | ||
} | ||
} |
Oops, something went wrong.