From 4bf3d6d8f0e3f9540d4c2b9996acf2c1be04d5a9 Mon Sep 17 00:00:00 2001 From: Anh Nguyen Date: Fri, 7 Jan 2022 14:24:49 +0700 Subject: [PATCH 1/5] update unit tests and spm spec with Swift 5.5 --- Package.swift | 36 ++++++++++++++----- Tests/TweetNaclTests/NaclBox_Tests.swift | 3 +- .../NaclScalarMulti_Tests.swift | 3 +- .../TweetNaclTests/NaclSecretbox_Tests.swift | 3 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Package.swift b/Package.swift index 7f31457..ebf88c3 100644 --- a/Package.swift +++ b/Package.swift @@ -1,10 +1,30 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + import PackageDescription -let package = Package(name: "TweetNacl", products: [.library(name: "TweetNacl", targets: ["TweetNacl"])], - targets: [ - .target(name: "CTweetNacl"), - .target(name: "TweetNacl", dependencies: ["CTweetNacl"]), - .testTarget(name: "TweetNaclTests", dependencies: ["TweetNacl"]), - ], - swiftLanguageVersions: [4]) \ No newline at end of file +let package = Package( + name: "TweetNacl", + products: [ + .library( + name: "TweetNacl", + targets: ["TweetNacl"]), + ], + dependencies: [], + targets: [ + .target(name: "CTweetNacl"), + .target( + name: "TweetNacl", + dependencies: ["CTweetNacl"]), + .testTarget( + name: "TweetNaclTests", + dependencies: ["TweetNacl"], + resources: [ + .process("SecretboxTestData.json"), + .process("BoxTestData.json"), + .process("ScalarMultiTestData.json"), + .process("SignTestData.json") + ] + ), + ] +) diff --git a/Tests/TweetNaclTests/NaclBox_Tests.swift b/Tests/TweetNaclTests/NaclBox_Tests.swift index 206baeb..81b504d 100644 --- a/Tests/TweetNaclTests/NaclBox_Tests.swift +++ b/Tests/TweetNaclTests/NaclBox_Tests.swift @@ -48,8 +48,7 @@ class NaclBox_Test: XCTestCase { let testSuite = XCTestSuite(name: NSStringFromClass(self)) - let testBundle = Bundle(for: NaclBox_Test.self) - let fileURL = testBundle.url(forResource: "BoxTestData", withExtension: "json") + let fileURL = Bundle.module.url(forResource: "BoxTestData", withExtension: "json") let fileData = try! Data(contentsOf: fileURL!) let json = try! JSONSerialization.jsonObject(with: fileData, options: []) let arrayOfData = json as! [Array] diff --git a/Tests/TweetNaclTests/NaclScalarMulti_Tests.swift b/Tests/TweetNaclTests/NaclScalarMulti_Tests.swift index 06276b2..53e403c 100644 --- a/Tests/TweetNaclTests/NaclScalarMulti_Tests.swift +++ b/Tests/TweetNaclTests/NaclScalarMulti_Tests.swift @@ -77,8 +77,7 @@ class NaclScalarMulti_Tests: XCTestCase { let testSuite = XCTestSuite(name: NSStringFromClass(self)) - let testBundle = Bundle(for: NaclSecretbox_Tests.self) - let fileURL = testBundle.url(forResource: "ScalarMultiTestData", withExtension: "json") + let fileURL = Bundle.module.url(forResource: "ScalarMultiTestData", withExtension: "json") let fileData = try! Data(contentsOf: fileURL!) let json = try! JSONSerialization.jsonObject(with: fileData, options: []) let arrayOfData = json as! [Array] diff --git a/Tests/TweetNaclTests/NaclSecretbox_Tests.swift b/Tests/TweetNaclTests/NaclSecretbox_Tests.swift index 30ce682..e458f3f 100644 --- a/Tests/TweetNaclTests/NaclSecretbox_Tests.swift +++ b/Tests/TweetNaclTests/NaclSecretbox_Tests.swift @@ -51,8 +51,7 @@ class NaclSecretbox_Tests: XCTestCase { let testSuite = XCTestSuite(name: NSStringFromClass(self)) - let testBundle = Bundle(for: NaclSecretbox_Tests.self) - let fileURL = testBundle.url(forResource: "SecretboxTestData", withExtension: "json") + let fileURL = Bundle.module.url(forResource: "SecretboxTestData", withExtension: "json") let fileData = try! Data(contentsOf: fileURL!) let jsonDecoder = JSONDecoder() let arrayOfData = try! jsonDecoder.decode([[String]].self, from: fileData) From 97b10899a936f34b635794e04a438b58f3a01691 Mon Sep 17 00:00:00 2001 From: Anh Nguyen Date: Fri, 7 Jan 2022 14:32:19 +0700 Subject: [PATCH 2/5] cocoapods - bump the version and delete a deprecated file --- .swift-version | 1 - TweetNacl.podspec | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .swift-version diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 389f774..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.0 \ No newline at end of file diff --git a/TweetNacl.podspec b/TweetNacl.podspec index 73ff6ec..d9f9f4d 100644 --- a/TweetNacl.podspec +++ b/TweetNacl.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "TweetNacl" - s.version = "1.0.2" + s.version = "1.1.1" s.summary = "TweetNacl wrapper library written in Swift." s.description = <<-DESC A Swift wrapper for TweetNacl C library From bf189c9d7759ca28cec2151013b861749c3e14f6 Mon Sep 17 00:00:00 2001 From: Anh Nguyen Date: Fri, 7 Jan 2022 14:51:49 +0700 Subject: [PATCH 3/5] [ci] test the matrix build --- .travis.yml | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 48bd13b..1acc34c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,32 @@ -language: objective-c -osx_image: xcode9 +language: swift branches: only: - master - -before_install: - - gem install xcpretty - -script: -- swift build -- xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-macOS test | xcpretty -- xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-iOS test | xcpretty -- xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-watchOS test | xcpretty -- xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-tvOS test | xcpretty +matrix: + include: + - name: "macOS" + os: osx + osx_image: xcode13.2 + script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-macOS test | xcpretty + - name: "iOS" + os: osx + osx_image: xcode13.2 + script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-iOS test | xcpretty + - name: "watchOS" + os: osx + osx_image: xcode13.2 + script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-watchOS test | xcpretty + - name: "tvOS" + os: osx + osx_image: xcode13.2 + script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-tvOS test | xcpretty + - name: "linux" + os: linux + env: TEST=Unix swift=5.5 + install: + - curl "https://swift.org/builds/swift-${swift}-release/ubuntu1604/swift-${swift}-RELEASE/swift-${swift}-RELEASE-ubuntu16.04.tar.gz" > /tmp/swift.tar.gz; + - tar -xzf /tmp/swift.tar.gz -C /tmp; + - export PATH="${PATH}:/tmp/swift-${swift}-RELEASE-ubuntu16.04/usr/bin"; + - swift -version; + script: swift test after_success: bash <(curl -s https://codecov.io/bash) \ No newline at end of file From 038b733a5fd534136319fa1cc2905ed808ef1dda Mon Sep 17 00:00:00 2001 From: Anh Nguyen Date: Fri, 7 Jan 2022 15:04:26 +0700 Subject: [PATCH 4/5] [ci] temporarily comment out the linux CI section --- .travis.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1acc34c..3f1fa9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,13 +20,13 @@ matrix: os: osx osx_image: xcode13.2 script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-tvOS test | xcpretty - - name: "linux" - os: linux - env: TEST=Unix swift=5.5 - install: - - curl "https://swift.org/builds/swift-${swift}-release/ubuntu1604/swift-${swift}-RELEASE/swift-${swift}-RELEASE-ubuntu16.04.tar.gz" > /tmp/swift.tar.gz; - - tar -xzf /tmp/swift.tar.gz -C /tmp; - - export PATH="${PATH}:/tmp/swift-${swift}-RELEASE-ubuntu16.04/usr/bin"; - - swift -version; - script: swift test + # - name: "linux" + # os: linux + # env: swift=5.5 + # install: + # - curl "https://swift.org/builds/swift-${swift}-release/ubuntu1604/swift-${swift}-RELEASE/swift-${swift}-RELEASE-ubuntu16.04.tar.gz" > /tmp/swift.tar.gz + # - tar -xzf /tmp/swift.tar.gz -C /tmp + # - export PATH="${PATH}:/tmp/swift-${swift}-RELEASE-ubuntu16.04/usr/bin" + # - swift -version + # script: swift test after_success: bash <(curl -s https://codecov.io/bash) \ No newline at end of file From 700a59db3541c270375f0cc95a8e7230e25a57a8 Mon Sep 17 00:00:00 2001 From: Anh Nguyen Date: Fri, 7 Jan 2022 15:31:02 +0700 Subject: [PATCH 5/5] update the travis CI spec --- .travis.yml | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f1fa9e..30fed26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,13 @@ -language: swift +language: objective-c +osx_image: xcode13.2 branches: only: - master -matrix: - include: - - name: "macOS" - os: osx - osx_image: xcode13.2 - script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-macOS test | xcpretty - - name: "iOS" - os: osx - osx_image: xcode13.2 - script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-iOS test | xcpretty - - name: "watchOS" - os: osx - osx_image: xcode13.2 - script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-watchOS test | xcpretty - - name: "tvOS" - os: osx - osx_image: xcode13.2 - script: xcrun xcodebuild -project TweetNacl.xcodeproj -scheme TweetNacl-tvOS test | xcpretty - # - name: "linux" - # os: linux - # env: swift=5.5 - # install: - # - curl "https://swift.org/builds/swift-${swift}-release/ubuntu1604/swift-${swift}-RELEASE/swift-${swift}-RELEASE-ubuntu16.04.tar.gz" > /tmp/swift.tar.gz - # - tar -xzf /tmp/swift.tar.gz -C /tmp - # - export PATH="${PATH}:/tmp/swift-${swift}-RELEASE-ubuntu16.04/usr/bin" - # - swift -version - # script: swift test + +before_install: + - gem install xcpretty + +script: +- swift build +- swift test after_success: bash <(curl -s https://codecov.io/bash) \ No newline at end of file