Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions to parity with existing CI #469

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Main

on:
push:
branches: [main]

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: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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: "SwiftNIO"
format_check_enabled: false
unacceptable_language_check_enabled: true
PeterAdams-A marked this conversation as resolved.
Show resolved Hide resolved
shell_check_enabled: false
python_lint_check_enabled: false

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: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

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
20 changes: 20 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Scheduled

on:
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: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
Empty file removed .gitmodules
Empty file.
46 changes: 46 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.gitignore
**/.gitignore
.licenseignore
.unacceptablelanguageignore
.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
dev/update-benchmark-thresholds
*.crt
**/*.crt
*.pem
**/*.pem
*.der
**/*.der
.swiftformat
.gitmodules
FuzzTesting/FailCases/*
Tests/hpack-test-case/*
1 change: 1 addition & 0 deletions .unacceptablelanguageignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tests/hpack-test-case/*/story_20.json
4 changes: 2 additions & 2 deletions IntegrationTests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ fi

# report
if [[ $cnt_fail > 0 ]]; then
# kill leftovers (the whole process group)
# kill leftovers (the whole process group) # ignore-unacceptable-language
trap '' TERM
kill 0
kill 0 # ignore-unacceptable-language

plugins_do summary_fail "$cnt_ok" "$cnt_fail"
else
Expand Down
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.60.0"),
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.0.2"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
],
targets: [
.executableTarget(
Expand Down
10 changes: 7 additions & 3 deletions Sources/NIOHPACK/HPACKDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ public struct HPACKDecoder: Sendable {

/// Creates a new decoder
///
/// - Parameter maxDynamicTableSize: Maximum allowed size of the dynamic header table.
/// - Parameters:
/// - allocator: Allocator for headers view byte buffer (which is deprecated)
/// - maxDynamicTableSize: Maximum allowed size of the dynamic header table.
public init(allocator: ByteBufferAllocator, maxDynamicTableSize: Int = HPACKDecoder.maxDynamicTableSize) {
self.init(allocator: allocator, maxDynamicTableSize: maxDynamicTableSize, maxHeaderListSize: HPACKDecoder.defaultMaxHeaderListSize)
}

/// Creates a new decoder
///
/// - Parameter maxDynamicTableSize: Maximum allowed size of the dynamic header table.
/// - Parameter maxHeaderListSize: Maximum allowed size of a decoded header list.
/// - Parameters:
/// - allocator: Allocator for headers view byte buffer (which is deprecated)
/// - maxDynamicTableSize: Maximum allowed size of the dynamic header table.
/// - maxHeaderListSize: Maximum allowed size of a decoded header list.
public init(allocator: ByteBufferAllocator, maxDynamicTableSize: Int, maxHeaderListSize: Int) {
precondition(maxHeaderListSize > 0, "Max header list size must be positive!")
self.headerTable = IndexedHeaderTable(allocator: allocator, maxDynamicTableSize: maxDynamicTableSize)
Expand Down
1 change: 1 addition & 0 deletions Sources/NIOHPACK/HPACKEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public struct HPACKEncoder {
///
/// - Parameters:
/// - allocator: An allocator for `ByteBuffer`s.
/// - useHuffmanEncoding: Should huffman enccoding be used.
/// - maxDynamicTableSize: An initial maximum size for the encoder's dynamic header table.
public init(allocator: ByteBufferAllocator, useHuffmanEncoding: Bool = true, maxDynamicTableSize: Int = HPACKEncoder.defaultDynamicTableSize) {
self.headerIndexTable = IndexedHeaderTable(allocator: allocator, maxDynamicTableSize: maxDynamicTableSize)
Expand Down
9 changes: 6 additions & 3 deletions Sources/NIOHPACK/HPACKHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ public struct HPACKHeaders: ExpressibleByDictionaryLiteral, Sendable {
/// This method is strictly additive: if there are other entries with the same header
/// name already in the block, this will add new entries.
///
/// - Parameter contentsOf: The sequence of header name/value pairs. Header names must be ASCII
/// - Parameters:
/// - other: The sequence of header name/value pairs. Header names must be ASCII
/// strings. For HTTP/2 lowercase header names are strongly recommended.
/// - indexing: The types of indexing and rewriting operations a decoder may take with
/// regard to this header.
@inlinable
public mutating func add<S: Sequence>(contentsOf other: S, indexing: HPACKIndexing = .indexable) where S.Element == (String, String) {
self.reserveCapacity(self.headers.count + other.underestimatedCount)
Expand All @@ -162,7 +165,7 @@ public struct HPACKHeaders: ExpressibleByDictionaryLiteral, Sendable {
/// This method is strictly additive: if there are other entries with the same header
/// name already in the block, this will add new entries.
///
/// - Parameter contentsOf: The sequence of header name/value/indexing triplets. Header names
/// - Parameter other: The sequence of header name/value/indexing triplets. Header names
/// must be ASCII strings. For HTTP/2 lowercase header names are strongly recommended.
@inlinable
public mutating func add<S: Sequence>(contentsOf other: S) where S.Element == HPACKHeaders.Element {
Expand Down Expand Up @@ -198,7 +201,7 @@ public struct HPACKHeaders: ExpressibleByDictionaryLiteral, Sendable {
///
/// This method uses case-insensitive comparisons for the header field name.
///
/// - Parameter name: The name of the header field to remove from the block.
/// - Parameter nameToRemove: The name of the header field to remove from the block.
@inlinable
public mutating func remove(name nameToRemove: String) {
self.headers.removeAll { header in
Expand Down
1 change: 0 additions & 1 deletion Sources/NIOHPACK/IndexedHeaderTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public struct IndexedHeaderTable {
/// - Parameters:
/// - name: The name of the header to insert.
/// - value: The value of the header to insert.
/// - Returns: `true` if the header was added to the table, `false` if not.
public mutating func add(headerNamed name: String, value: String) throws {
// This function is unnecessarily marked throws, but none of its underlying functions throw anymore.
self.dynamicTable.addHeader(named: name, value: value)
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOHTTP2/Frame Buffers/ConcurrentStreamBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ struct ConcurrentStreamBuffer {
// Ok, we need to buffer this frame, and we know we have the index for it. What we do here depends on this frame type. For
// almost all frames, we just append them to the buffer. For RST_STREAM, however, we're in a different spot. RST_STREAM is a
// request to drop all resources for a given stream. We know we have some, but we shouldn't wait to unblock them, we should
// just kill them now and immediately free the resources.
// just remove them now and immediately free the resources.
if case .rstStream(let reason) = frame.payload {
// We're going to remove the buffer and fail all the writes.
let writeBuffer = self.bufferedFrames.remove(at: index)

// If we're currently unbuffering this stream, we need to pass the RST_STREAM frame on for correctness. If we aren't, just
// kill it.
// drop it.
if writeBuffer.currentlyUnblocking {
return .forwardAndDrop(writeBuffer.frames, NIOHTTP2Errors.streamClosed(streamID: frame.streamID, errorCode: reason))
} else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOHTTP2/Frame Buffers/ControlFrameBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct ControlFrameBuffer {
private var pendingControlFrames: MarkedCircularBuffer<PendingControlFrame>

/// The maximum size of the buffer. If we have to buffer more frames than this,
/// we'll kill the connection.
/// we'll close the connection.
internal var maximumBufferSize: Int
}

Expand Down
Loading