Skip to content

Commit 560aad2

Browse files
author
Simon Pilkington
committed
Add Swift 5.0 and 5.1 CI tests. Fix compile warning under Swift 5.x.
1 parent 5f75f6f commit 560aad2

12 files changed

+63
-33
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
build
22
.DS_Store
33
.build/
4+
.swiftpm/
45
*.xcodeproj
56
*~

.travis.yml

+20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
# Matrix of required of OS and Swift releases
22
matrix:
33
include:
4+
- os: linux
5+
dist: xenial
6+
sudo: required
7+
services: docker
8+
env: DOCKER_IMAGE_TAG=swift:5.1-bionic USE_SWIFT_LINT=no
9+
- os: linux
10+
dist: xenial
11+
sudo: required
12+
services: docker
13+
env: DOCKER_IMAGE_TAG=swift:5.1-xenial USE_SWIFT_LINT=no
14+
- os: linux
15+
dist: xenial
16+
sudo: required
17+
services: docker
18+
env: DOCKER_IMAGE_TAG=swift:5.0.1-bionic USE_SWIFT_LINT=yes
19+
- os: linux
20+
dist: xenial
21+
sudo: required
22+
services: docker
23+
env: DOCKER_IMAGE_TAG=swift:5.0.1-xenial USE_SWIFT_LINT=yes
424
- os: linux
525
dist: xenial
626
sudo: required

CITests/run

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/bin/bash
22
set -e
33

4-
swiftLintVersion=0.29.0
4+
swiftLintVersion=0.33.0
55

66
USE_SWIFT_LINT=$1
77

8+
apt-get update
9+
apt-get -y install libssl-dev libz-dev
10+
811
workspaceRoot=($PWD)
912
srcRoot=$workspaceRoot/sources
1013
mkdir -p $srcRoot

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
<a href="http://swift.org">
1010
<img src="https://img.shields.io/badge/swift-4.2-orange.svg?style=flat" alt="Swift 4.1 Compatible">
1111
</a>
12+
<a href="http://swift.org">
13+
<img src="https://img.shields.io/badge/swift-5.0-orange.svg?style=flat" alt="Swift 5.0 Compatible">
14+
</a>
15+
<a href="http://swift.org">
16+
<img src="https://img.shields.io/badge/swift-5.1-orange.svg?style=flat" alt="Swift 5.1 Compatible">
17+
</a>
1218
<a href="https://gitter.im/SmokeServerSide">
1319
<img src="https://img.shields.io/badge/chat-on%20gitter-ee115e.svg?style=flat" alt="Join the Smoke Server Side community on gitter">
1420
</a>

Sources/SmokeDynamoDB/AWSDynamoDBKeysProjection+DynamoDBKeysProjectionAsync.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import LoggerAPI
2424
/// DynamoDBKeysProjection conformance async functions
2525
public extension AWSDynamoDBKeysProjection {
2626

27-
public func queryAsync<AttributesType>(
27+
func queryAsync<AttributesType>(
2828
forPartitionKey partitionKey: String,
2929
sortKeyCondition: AttributeCondition?,
3030
completion: @escaping (HTTPResult<[CompositePrimaryKey<AttributesType>]>) -> ())
@@ -76,7 +76,7 @@ public extension AWSDynamoDBKeysProjection {
7676
completion: handleQueryResult)
7777
}
7878

79-
public func queryAsync<AttributesType>(
79+
func queryAsync<AttributesType>(
8080
forPartitionKey partitionKey: String,
8181
sortKeyCondition: AttributeCondition?,
8282
limit: Int?,

Sources/SmokeDynamoDB/AWSDynamoDBKeysProjection+DynamoDBKeysProjectionSync.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import LoggerAPI
2424
/// DynamoDBKeysProjection conformance sync functions
2525
public extension AWSDynamoDBKeysProjection {
2626

27-
public func querySync<AttributesType>(forPartitionKey partitionKey: String,
27+
func querySync<AttributesType>(forPartitionKey partitionKey: String,
2828
sortKeyCondition: AttributeCondition?) throws
2929
-> [CompositePrimaryKey<AttributesType>] {
3030

@@ -50,7 +50,7 @@ public extension AWSDynamoDBKeysProjection {
5050
}
5151
}
5252

53-
public func querySync<AttributesType>(forPartitionKey partitionKey: String,
53+
func querySync<AttributesType>(forPartitionKey partitionKey: String,
5454
sortKeyCondition: AttributeCondition?,
5555
limit: Int?,
5656
exclusiveStartKey: String?) throws

Sources/SmokeDynamoDB/AWSDynamoDBTable+DynamoDBTableAsync.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import LoggerAPI
2424
/// DynamoDBTable conformance async functions
2525
public extension AWSDynamoDBTable {
2626

27-
public func insertItemAsync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>,
27+
func insertItemAsync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>,
2828
completion: @escaping (Error?) -> ())
2929
throws where AttributesType: PrimaryKeyAttributes, ItemType: Decodable, ItemType: Encodable {
3030
let putItemInput = try getInputForInsert(item)
@@ -33,7 +33,7 @@ public extension AWSDynamoDBTable {
3333
completion: completion)
3434
}
3535

36-
public func clobberItemAsync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>,
36+
func clobberItemAsync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>,
3737
completion: @escaping (Error?) -> ())
3838
throws where AttributesType: PrimaryKeyAttributes, ItemType: Decodable, ItemType: Encodable {
3939
let attributes = try getAttributes(forItem: item)
@@ -44,7 +44,7 @@ public extension AWSDynamoDBTable {
4444
try putItemAsync(forInput: putItemInput, withKey: item.compositePrimaryKey, completion: completion)
4545
}
4646

47-
public func updateItemAsync<AttributesType, ItemType>(newItem: TypedDatabaseItem<AttributesType, ItemType>,
47+
func updateItemAsync<AttributesType, ItemType>(newItem: TypedDatabaseItem<AttributesType, ItemType>,
4848
existingItem: TypedDatabaseItem<AttributesType, ItemType>,
4949
completion: @escaping (Error?) -> ())
5050
throws where AttributesType: PrimaryKeyAttributes, ItemType: Decodable, ItemType: Encodable {
@@ -53,7 +53,7 @@ public extension AWSDynamoDBTable {
5353
try putItemAsync(forInput: putItemInput, withKey: newItem.compositePrimaryKey, completion: completion)
5454
}
5555

56-
public func getItemAsync<AttributesType, ItemType>(forKey key: CompositePrimaryKey<AttributesType>,
56+
func getItemAsync<AttributesType, ItemType>(forKey key: CompositePrimaryKey<AttributesType>,
5757
completion: @escaping (HTTPResult<TypedDatabaseItem<AttributesType, ItemType>?>) -> ())
5858
throws where AttributesType: PrimaryKeyAttributes, ItemType: Decodable, ItemType: Encodable {
5959
let putItemInput = try getInputForGetItem(forKey: key)
@@ -83,7 +83,7 @@ public extension AWSDynamoDBTable {
8383
}
8484
}
8585

86-
public func deleteItemAsync<AttributesType>(forKey key: CompositePrimaryKey<AttributesType>,
86+
func deleteItemAsync<AttributesType>(forKey key: CompositePrimaryKey<AttributesType>,
8787
completion: @escaping (Error?) -> ())
8888
throws where AttributesType: PrimaryKeyAttributes {
8989
let deleteItemInput = try getInputForDeleteItem(forKey: key)
@@ -100,7 +100,7 @@ public extension AWSDynamoDBTable {
100100
}
101101
}
102102

103-
public func queryAsync<AttributesType, PossibleTypes>(
103+
func queryAsync<AttributesType, PossibleTypes>(
104104
forPartitionKey partitionKey: String,
105105
sortKeyCondition: AttributeCondition?,
106106
completion: @escaping (HTTPResult<[PolymorphicDatabaseItem<AttributesType, PossibleTypes>]>) -> ())
@@ -152,7 +152,7 @@ public extension AWSDynamoDBTable {
152152
completion: handleQueryResult)
153153
}
154154

155-
public func queryAsync<AttributesType, PossibleTypes>(
155+
func queryAsync<AttributesType, PossibleTypes>(
156156
forPartitionKey partitionKey: String,
157157
sortKeyCondition: AttributeCondition?,
158158
limit: Int, exclusiveStartKey: String?,

Sources/SmokeDynamoDB/AWSDynamoDBTable+DynamoDBTableSync.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import LoggerAPI
2424
/// DynamoDBTable conformance sync functions
2525
public extension AWSDynamoDBTable {
2626

27-
public func insertItemSync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>) throws {
27+
func insertItemSync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>) throws {
2828
let putItemInput = try getInputForInsert(item)
2929

3030
try putItemSync(forInput: putItemInput, withKey: item.compositePrimaryKey)
3131
}
3232

33-
public func clobberItemSync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>) throws {
33+
func clobberItemSync<AttributesType, ItemType>(_ item: TypedDatabaseItem<AttributesType, ItemType>) throws {
3434
let attributes = try getAttributes(forItem: item)
3535

3636
let putItemInput = DynamoDBModel.PutItemInput(item: attributes,
@@ -39,14 +39,14 @@ public extension AWSDynamoDBTable {
3939
try putItemSync(forInput: putItemInput, withKey: item.compositePrimaryKey)
4040
}
4141

42-
public func updateItemSync<AttributesType, ItemType>(newItem: TypedDatabaseItem<AttributesType, ItemType>,
42+
func updateItemSync<AttributesType, ItemType>(newItem: TypedDatabaseItem<AttributesType, ItemType>,
4343
existingItem: TypedDatabaseItem<AttributesType, ItemType>) throws {
4444
let putItemInput = try getInputForUpdateItem(newItem: newItem, existingItem: existingItem)
4545

4646
try putItemSync(forInput: putItemInput, withKey: newItem.compositePrimaryKey)
4747
}
4848

49-
public func getItemSync<AttributesType, ItemType>(forKey key: CompositePrimaryKey<AttributesType>) throws
49+
func getItemSync<AttributesType, ItemType>(forKey key: CompositePrimaryKey<AttributesType>) throws
5050
-> TypedDatabaseItem<AttributesType, ItemType>? {
5151
let putItemInput = try getInputForGetItem(forKey: key)
5252

@@ -64,14 +64,14 @@ public extension AWSDynamoDBTable {
6464
}
6565
}
6666

67-
public func deleteItemSync<AttributesType>(forKey key: CompositePrimaryKey<AttributesType>) throws {
67+
func deleteItemSync<AttributesType>(forKey key: CompositePrimaryKey<AttributesType>) throws {
6868
let deleteItemInput = try getInputForDeleteItem(forKey: key)
6969

7070
Log.verbose("dynamodb.deleteItem with key: \(key) and table name \(targetTableName)")
7171
_ = try dynamodb.deleteItemSync(input: deleteItemInput)
7272
}
7373

74-
public func querySync<AttributesType, PossibleTypes>(forPartitionKey partitionKey: String,
74+
func querySync<AttributesType, PossibleTypes>(forPartitionKey partitionKey: String,
7575
sortKeyCondition: AttributeCondition?) throws
7676
-> [PolymorphicDatabaseItem<AttributesType, PossibleTypes>] {
7777

@@ -97,7 +97,7 @@ public extension AWSDynamoDBTable {
9797
}
9898
}
9999

100-
public func querySync<AttributesType, PossibleTypes>(forPartitionKey partitionKey: String,
100+
func querySync<AttributesType, PossibleTypes>(forPartitionKey partitionKey: String,
101101
sortKeyCondition: AttributeCondition?,
102102
limit: Int,
103103
exclusiveStartKey: String?) throws

Sources/SmokeDynamoDB/DynamoDBTable+clobberVersionedItemWithHistoricalRow.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension DynamoDBTable {
3434
- generateSortKey: generator to provide a sort key for a provided
3535
version number.
3636
*/
37-
public func clobberVersionedItemWithHistoricalRowSync<AttributesType: PrimaryKeyAttributes, ItemType: Codable>(
37+
func clobberVersionedItemWithHistoricalRowSync<AttributesType: PrimaryKeyAttributes, ItemType: Codable>(
3838
forPrimaryKey partitionKey: String,
3939
andHistoricalKey historicalKey: String,
4040
item: ItemType,
@@ -87,7 +87,7 @@ public extension DynamoDBTable {
8787
version number.
8888
- completion: completion handler providing an error that was thrown or nil
8989
*/
90-
public func clobberVersionedItemWithHistoricalRowAsync<AttributesType: PrimaryKeyAttributes, ItemType: Codable>(
90+
func clobberVersionedItemWithHistoricalRowAsync<AttributesType: PrimaryKeyAttributes, ItemType: Codable>(
9191
forPrimaryKey partitionKey: String,
9292
andHistoricalKey historicalKey: String,
9393
item: ItemType,

Sources/SmokeDynamoDB/DynamoDBTable+conditionallyUpdateItem.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension DynamoDBTable {
3434
withRetries: the number of times to attempt to retry the update before failing.
3535
updatedPayloadProvider: the provider that will return updated payloads.
3636
*/
37-
public func conditionallyUpdateItemSync<AttributesType, ItemType: Codable>(
37+
func conditionallyUpdateItemSync<AttributesType, ItemType: Codable>(
3838
forKey key: CompositePrimaryKey<AttributesType>,
3939
withRetries retries: Int = 10,
4040
updatedPayloadProvider: (ItemType) throws -> ItemType) throws {
@@ -64,7 +64,7 @@ public extension DynamoDBTable {
6464
}
6565
}
6666

67-
public func conditionallyUpdateItemAsync<AttributesType, ItemType: Codable>(
67+
func conditionallyUpdateItemAsync<AttributesType, ItemType: Codable>(
6868
forKey key: CompositePrimaryKey<AttributesType>,
6969
withRetries retries: Int = 10,
7070
updatedPayloadProvider: @escaping (ItemType) throws -> ItemType,

Sources/SmokeDynamoDB/DynamoDBTableHistoricalItemExtensions.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public extension DynamoDBTable {
2626
* Historical items exist across multiple rows. This method provides an interface to record all
2727
* rows in a single call.
2828
*/
29-
public func insertItemWithHistoricalRowSync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
29+
func insertItemWithHistoricalRowSync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
3030
historicalItem: TypedDatabaseItem<AttributesType, ItemType>) throws {
3131
try insertItemSync(primaryItem)
3232
try insertItemSync(historicalItem)
3333
}
3434

35-
public func insertItemWithHistoricalRowAsync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
35+
func insertItemWithHistoricalRowAsync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
3636
historicalItem: TypedDatabaseItem<AttributesType, ItemType>,
3737
completion: @escaping (Error?) -> ()) throws {
3838
try insertItemAsync(primaryItem) { error in
@@ -48,14 +48,14 @@ public extension DynamoDBTable {
4848
}
4949
}
5050

51-
public func updateItemWithHistoricalRowSync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
51+
func updateItemWithHistoricalRowSync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
5252
existingItem: TypedDatabaseItem<AttributesType, ItemType>,
5353
historicalItem: TypedDatabaseItem<AttributesType, ItemType>) throws {
5454
try updateItemSync(newItem: primaryItem, existingItem: existingItem)
5555
try insertItemSync(historicalItem)
5656
}
5757

58-
public func updateItemWithHistoricalRowAsync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
58+
func updateItemWithHistoricalRowAsync<AttributesType, ItemType>(primaryItem: TypedDatabaseItem<AttributesType, ItemType>,
5959
existingItem: TypedDatabaseItem<AttributesType, ItemType>,
6060
historicalItem: TypedDatabaseItem<AttributesType, ItemType>,
6161
completion: @escaping (Error?) -> ()) throws {
@@ -84,7 +84,7 @@ public extension DynamoDBTable {
8484
* Clobbering a historical item requires knowledge of existing rows to accurately record
8585
* historical data.
8686
*/
87-
public func clobberItemWithHistoricalRowSync<AttributesType, ItemType>(
87+
func clobberItemWithHistoricalRowSync<AttributesType, ItemType>(
8888
primaryItemProvider: (TypedDatabaseItem<AttributesType, ItemType>?) -> TypedDatabaseItem<AttributesType, ItemType>,
8989
historicalItemProvider: (TypedDatabaseItem<AttributesType, ItemType>) -> TypedDatabaseItem<AttributesType, ItemType>,
9090
withRetries retries: Int = 10) throws {
@@ -132,7 +132,7 @@ public extension DynamoDBTable {
132132
* Clobbering a historical item requires knowledge of existing rows to accurately record
133133
* historical data.
134134
*/
135-
public func clobberItemWithHistoricalRowAsync<AttributesType, ItemType>(
135+
func clobberItemWithHistoricalRowAsync<AttributesType, ItemType>(
136136
primaryItemProvider: @escaping (TypedDatabaseItem<AttributesType, ItemType>?) -> TypedDatabaseItem<AttributesType, ItemType>,
137137
historicalItemProvider: @escaping (TypedDatabaseItem<AttributesType, ItemType>) -> TypedDatabaseItem<AttributesType, ItemType>,
138138
withRetries retries: Int = 10,
@@ -201,7 +201,7 @@ public extension DynamoDBTable {
201201
- primaryItemProvider: Function to provide the updated item or throw if the current item can't be updated.
202202
- historicalItemProvider: Function to provide the historical item for the primary item.
203203
*/
204-
public func conditionallyUpdateItemWithHistoricalRowSync<AttributesType, ItemType>(
204+
func conditionallyUpdateItemWithHistoricalRowSync<AttributesType, ItemType>(
205205
compositePrimaryKey: CompositePrimaryKey<AttributesType>,
206206
primaryItemProvider: (TypedDatabaseItem<AttributesType, ItemType>) throws -> TypedDatabaseItem<AttributesType, ItemType>,
207207
historicalItemProvider: (TypedDatabaseItem<AttributesType, ItemType>) -> TypedDatabaseItem<AttributesType, ItemType>,
@@ -290,7 +290,7 @@ public extension DynamoDBTable {
290290
- primaryItemProvider: Function to provide the updated item or throw if the current item can't be updated.
291291
- historicalItemProvider: Function to provide the historical item for the primary item.
292292
*/
293-
public func conditionallyUpdateItemWithHistoricalRowAsync<AttributesType, ItemType>(
293+
func conditionallyUpdateItemWithHistoricalRowAsync<AttributesType, ItemType>(
294294
forPrimaryKey compositePrimaryKey: CompositePrimaryKey<AttributesType>,
295295
primaryItemProvider: @escaping (TypedDatabaseItem<AttributesType, ItemType>) throws -> TypedDatabaseItem<AttributesType, ItemType>,
296296
historicalItemProvider: @escaping (TypedDatabaseItem<AttributesType, ItemType>) -> TypedDatabaseItem<AttributesType, ItemType>,

Sources/SmokeDynamoDB/String+DynamoDBKey.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import Foundation
2020
/// Extension for Arrays of Strings
2121
public extension Array where Element == String {
2222
// Transforms the Array into a Dynamo key - putting dots between each element.
23-
public var dynamodbKey: String {
23+
var dynamodbKey: String {
2424
// return all elements joined with dots
2525
return self.joined(separator: ".")
2626
}
2727

2828
// Transforms an Array into a DynamoDB key prefix - a DynamoDB key with a dot on the end.
29-
public var dynamodbKeyPrefix: String {
29+
var dynamodbKeyPrefix: String {
3030

3131
let dynamodbKey = self.dynamodbKey
3232
if dynamodbKey.count == 0 {

0 commit comments

Comments
 (0)