Skip to content

Commit

Permalink
Initial adoption of github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ktoso committed Nov 8, 2024
1 parent c8f217f commit 1e7fe41
Show file tree
Hide file tree
Showing 82 changed files with 2,054 additions and 1,602 deletions.
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_[One line description of your change]_

### Motivation:

_[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]_

### Modifications:

_[Describe the modifications you've done.]_

### Result:

- Resolves #
- _[After your change, what will change.]_
1 change: 0 additions & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ changelog:
- title: 🚨🚨🚨 Missing Labels - Add labels to the prs listed here and generate the release notes again
labels:
- "*"

23 changes: 23 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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: "RediStack"

unit-tests:
name: Unit tests
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
linux_exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
# since we don't have systemctl, we run the redis server manually in the background
linux_pre_build_command: apt-get update -y && apt-get install redis -y
linux_env_vars: REDIS_URL=redis
linux_build_command: bash -c 'nohup redis-server & swift test'
enable_windows_checks: false
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
36 changes: 36 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.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
IntegrationTests/*.sh
72 changes: 72 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{


"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" : {
"NoBlockComments" : false,
"DontRepeatTypeInStaticProperties" : false,
"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
}
}
7 changes: 7 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: default

rules:
line-length: false
document-start: false
truthy:
check-keys: false # Otherwise we get a false positive on GitHub action's `on` key
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When editing a file, ensure that the copyright header states the year `2019-<cur

### Git Workflow

`master` is always the development branch.
`main` is always the development branch.

For **minor** or **patch** SemVer changes, create a branch off of the tagged commit.

Expand Down
18 changes: 9 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ let package = Package(
products: [
.library(name: "RediStack", targets: ["RediStack"]),
.library(name: "RediStackTestUtils", targets: ["RediStackTestUtils"]),
.library(name: "RedisTypes", targets: ["RedisTypes"])
.library(name: "RedisTypes", targets: ["RedisTypes"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-metrics.git", "1.0.0" ..< "3.0.0"),
.package(url: "https://github.com/apple/swift-metrics.git", "1.0.0"..<"3.0.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.43.0"),
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.23.1"),
],
Expand All @@ -40,7 +40,7 @@ let package = Package(
.product(name: "NIOSSL", package: "swift-nio-ssl"),
.product(name: "Atomics", package: "swift-atomics"),
.product(name: "Logging", package: "swift-log"),
.product(name: "Metrics", package: "swift-metrics")
.product(name: "Metrics", package: "swift-metrics"),
]
),
.target(name: "RedisTypes", dependencies: ["RediStack"]),
Expand All @@ -49,13 +49,13 @@ let package = Package(
dependencies: [
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
"RediStack"
"RediStack",
]
),
.target(
name: "RESP3",
dependencies: [
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio")
]
),
.testTarget(
Expand All @@ -65,14 +65,14 @@ let package = Package(
"RediStackTestUtils",
.product(name: "Atomics", package: "swift-atomics"),
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOTestUtils", package: "swift-nio")
.product(name: "NIOTestUtils", package: "swift-nio"),
]
),
.testTarget(
name: "RedisTypesTests",
dependencies: [
"RediStack", "RedisTypes", "RediStackTestUtils",
.product(name: "NIO", package: "swift-nio")
.product(name: "NIO", package: "swift-nio"),
]
),
.testTarget(
Expand All @@ -88,8 +88,8 @@ let package = Package(
name: "RediStackIntegrationTests",
dependencies: [
"RediStack", "RediStackTestUtils",
.product(name: "NIO", package: "swift-nio")
.product(name: "NIO", package: "swift-nio"),
]
)
),
]
)
17 changes: 8 additions & 9 deletions Sources/RESP3/RESP3Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct RESP3Token: Hashable, Sendable {
}

public mutating func next() -> RESP3Token? {
return try! RESP3Token(consuming: &self.buffer)
try! RESP3Token(consuming: &self.buffer)
}
}
}
Expand Down Expand Up @@ -194,19 +194,19 @@ public struct RESP3Token: Hashable, Sendable {
validated = try buffer.readRESPBooleanSlice()

case .some(.blobString),
.some(.verbatimString),
.some(.blobError):
.some(.verbatimString),
.some(.blobError):
validated = try buffer.readRESPBlobStringSlice()

case .some(.simpleString),
.some(.simpleError):
.some(.simpleError):
validated = try buffer.readRESPSimpleStringSlice()

case .some(.array),
.some(.push),
.some(.set),
.some(.map),
.some(.attribute):
.some(.push),
.some(.set),
.some(.map),
.some(.attribute):
validated = try buffer.readRESPAggregateSlice(depth: depth)

case .some(.integer):
Expand Down Expand Up @@ -514,4 +514,3 @@ extension UInt32 {
return value
}()
}

30 changes: 15 additions & 15 deletions Sources/RESP3/RESP3TypeIdentifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
//===----------------------------------------------------------------------===//

enum RESP3TypeIdentifier: UInt8 {
case integer = 58 // UInt8(ascii: ":")
case double = 44 // UInt8.comma
case simpleString = 43 // UInt8.plus
case simpleError = 45 // UInt8.min
case blobString = 36 // UInt8.dollar
case blobError = 33 // UInt8.exclamationMark
case verbatimString = 61 // UInt8.equals
case boolean = 35 // UInt8.pound
case null = 95 // UInt8.underscore
case bigNumber = 40 // UInt8.leftRoundBracket
case array = 42 // UInt8.asterisk
case map = 37 // UInt8.percent
case set = 126 // UInt8.tilde
case attribute = 124 // UInt8.pipe
case push = 62 // UInt8.rightAngledBracket
case integer = 58 // UInt8(ascii: ":")
case double = 44 // UInt8.comma
case simpleString = 43 // UInt8.plus
case simpleError = 45 // UInt8.min
case blobString = 36 // UInt8.dollar
case blobError = 33 // UInt8.exclamationMark
case verbatimString = 61 // UInt8.equals
case boolean = 35 // UInt8.pound
case null = 95 // UInt8.underscore
case bigNumber = 40 // UInt8.leftRoundBracket
case array = 42 // UInt8.asterisk
case map = 37 // UInt8.percent
case set = 126 // UInt8.tilde
case attribute = 124 // UInt8.pipe
case push = 62 // UInt8.rightAngledBracket
}

extension UInt8 {
Expand Down
4 changes: 2 additions & 2 deletions Sources/RediStack/ChannelHandlers/RedisByteDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import NIOCore
public final class RedisByteDecoder: NIOSingleStepByteToMessageDecoder {
/// `ByteToMessageDecoder.InboundOut`
public typealias InboundOut = RESPValue

private let parser: RESPTranslator

public init() {
self.parser = RESPTranslator()
}
Expand Down
Loading

0 comments on commit 1e7fe41

Please sign in to comment.