-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into sb/timer-api
- Loading branch information
Showing
70 changed files
with
1,080 additions
and
604 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,14 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
|
||
jobs: | ||
call-reusable-pull-request-workflow: | ||
name: Checks | ||
uses: ./.github/workflows/reusable_pull_request.yml | ||
with: | ||
benchmarks_linux_package_path: "Benchmarks" | ||
license_header_check_project_name: "SwiftNIO" | ||
format_check_enabled: false |
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,193 @@ | ||
name: Pull Request | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
unit_tests_linux_enabled: | ||
type: boolean | ||
description: "Boolean to enable the unit tests linux job. Defaults to true." | ||
default: true | ||
benchmarks_linux_enabled: | ||
type: boolean | ||
description: "Boolean to enable the benchmarks linux job. Defaults to true." | ||
default: true | ||
benchmarks_linux_package_path: | ||
type: string | ||
description: "Path to the package containing the benchmarks. Defaults to the repository root." | ||
default: "." | ||
api_breakage_check_enabled: | ||
type: boolean | ||
description: "Boolean to enable the API breakage check job. Defaults to true." | ||
default: true | ||
docs_check_enabled: | ||
type: boolean | ||
description: "Boolean to enable the docs check job. Defaults to true." | ||
default: true | ||
unacceptable_language_check_enabled: | ||
type: boolean | ||
description: "Boolean to enable the acceptable language check job. Defaults to true." | ||
default: true | ||
unacceptable_language_check_word_list: | ||
type: string | ||
description: "List of unacceptable words. Defaults to a sensible list of words." | ||
default: "blacklist whitelist slave master sane sanity insane insanity kill killed killing hang hung hanged hanging" #ignore-unacceptable-language | ||
license_header_check_enabled: | ||
type: boolean | ||
description: "Boolean to enable the license header check job. Defaults to true." | ||
default: true | ||
license_header_check_project_name: | ||
type: string | ||
description: "Name of the project called out in the license header." | ||
required: true | ||
broken_symlink_check_enabled: | ||
type: boolean | ||
description: "Boolean to enable the broken symlink check job. Defaults to true." | ||
default: true | ||
format_check_enabled: | ||
type: boolean | ||
description: "Boolean to enable the format check job. Defaults to true." | ||
default: true | ||
|
||
## We are cancelling previously triggered workflow runs | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit-tests-linux: | ||
name: Unit tests | ||
if: ${{ inputs.unit_tests_linux_enabled }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
swift: | ||
- image: swift:5.8-jammy | ||
- image: swift:5.9-jammy | ||
- image: swift:5.10-jammy | ||
- image: swiftlang/swift:nightly-6.0-jammy | ||
- image: swiftlang/swift:nightly-main-jammy | ||
container: | ||
image: ${{ matrix.swift.image }} | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run tests | ||
run: swift test | ||
|
||
benchmarks-linux: | ||
name: Benchmarks | ||
if: ${{ inputs.benchmarks_linux_enabled }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
swift: | ||
- image: swift:5.8-jammy | ||
swift_version: "5.8" | ||
- image: swift:5.9-jammy | ||
swift_version: "5.9" | ||
- image: swift:5.10-jammy | ||
swift_version: "5.10" | ||
- image: swiftlang/swift:nightly-6.0-jammy | ||
swift_version: "nightly-next" | ||
- image: swiftlang/swift:nightly-main-jammy | ||
swift_version: "nightly-main" | ||
container: | ||
image: ${{ matrix.swift.image }} | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run tests | ||
env: | ||
PACKAGE_PATH: ${{ inputs.benchmarks_linux_package_path }} | ||
SWIFT_VERSION: ${{ matrix.swift.swift_version }} | ||
run: | | ||
apt-get update -y -q && apt-get install -y -q libjemalloc-dev | ||
swift package --package-path ${PACKAGE_PATH} --disable-sandbox benchmark baseline check --check-absolute-path ${PACKAGE_PATH}/Thresholds/${SWIFT_VERSION}/ | ||
api-breakage-check: | ||
name: API breakage check | ||
if: ${{ inputs.api_breakage_check_enabled }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swift:5.10-noble | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# We need to fetch everything otherwise only the head commit will be fetched. | ||
fetch-depth: 0 | ||
- name: Mark the workspace as safe | ||
# https://github.com/actions/checkout/issues/766 | ||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE} | ||
- name: Run API breakage check | ||
run: swift package diagnose-api-breaking-changes origin/main | ||
|
||
docs-check: | ||
name: Documentation check | ||
if: ${{ inputs.docs_check_enabled }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swift:5.10-noble | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run documentation check | ||
run: | | ||
apt-get -qq update && apt-get -qq -y install curl | ||
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-docs.sh | bash | ||
unacceptable-language-check: | ||
name: Unacceptable language check | ||
if: ${{ inputs.unacceptable_language_check_enabled }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 1 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run unacceptable language check | ||
env: | ||
UNACCEPTABLE_WORD_LIST: ${{ inputs.unacceptable_language_check_word_list}} | ||
run: curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-unacceptable-language.sh | bash | ||
|
||
license-header-check: | ||
name: License headers check | ||
if: ${{ inputs.license_header_check_enabled }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 1 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run license header check | ||
env: | ||
PROJECT_NAME: ${{ inputs.license_header_check_project_name }} | ||
run: curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-license-header.sh | bash | ||
|
||
broken-symlink-check: | ||
name: Broken symlinks check | ||
if: ${{ inputs.broken_symlink_check_enabled }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 1 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run broken symlinks check | ||
run: curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-broken-symlinks.sh | bash | ||
|
||
format-check: | ||
name: Format check | ||
if: ${{ inputs.format_check_enabled }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swiftlang/swift:nightly-6.0-jammy | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run format check | ||
run: swift format lint --parallel --recursive --strict |
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,47 @@ | ||
.gitignore | ||
**/.gitignore | ||
.licenseignore | ||
.gitattributes | ||
.mailfilter | ||
.mailmap | ||
.spi.yml | ||
.swift-format | ||
.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/* | ||
Sources/CNIOAtomics/src/cpp_magic.h | ||
Sources/CNIOLLHTTP/LICENSE-MIT | ||
Sources/CNIOLLHTTP/c_nio_api.c | ||
Sources/CNIOLLHTTP/c_nio_http.c | ||
Sources/CNIOLLHTTP/c_nio_llhttp.c | ||
Sources/CNIOLLHTTP/include/c_nio_llhttp.h | ||
Sources/CNIOSHA1/c_nio_sha1.c | ||
Sources/CNIOSHA1/include/CNIOSHA1.h | ||
dev/alloc-limits-from-test-output | ||
dev/boxed-existentials.d | ||
dev/git.commit.template | ||
dev/lldb-smoker | ||
dev/make-single-file-spm | ||
dev/malloc-aggregation.d | ||
dev/update-alloc-limits-to-last-completed-ci-build | ||
scripts/nio-diagnose |
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,44 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftNIO open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the SwiftNIO project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
import NIOCore | ||
import NIOEmbedded | ||
|
||
let benchmarks = { | ||
let defaultMetrics: [BenchmarkMetric] = [ | ||
.mallocCountTotal, | ||
] | ||
|
||
Benchmark( | ||
"NIOAsyncChannel.init", | ||
configuration: Benchmark.Configuration(metrics: defaultMetrics) | ||
) { benchmark in | ||
// Elide the cost of the 'EmbeddedChannel'. It's only used for its pipeline. | ||
var channels: [EmbeddedChannel] = [] | ||
channels.reserveCapacity(benchmark.scaledIterations.count) | ||
for _ in 0 ..< benchmark.scaledIterations.count { | ||
channels.append(EmbeddedChannel()) | ||
} | ||
|
||
benchmark.startMeasurement() | ||
defer { | ||
benchmark.stopMeasurement() | ||
} | ||
for channel in channels { | ||
let asyncChanel = try NIOAsyncChannel<ByteBuffer, ByteBuffer>(wrappingChannelSynchronously: channel) | ||
blackHole(asyncChanel) | ||
} | ||
} | ||
} |
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
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.10/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 10 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.8/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 10 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.9/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 10 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/nightly-main/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 10 | ||
} |
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/nightly-next/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 10 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEcho.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 108 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json
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,3 @@ | ||
{ | ||
"mallocCountTotal" : 165000 | ||
} |
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
Oops, something went wrong.