Browse Source

Drop Swift 3.x

Norio Nomura 7 years ago
parent
commit
8cc406ab18
6 changed files with 32 additions and 144 deletions
  1. 16 73
      .circleci/config.yml
  2. 1 1
      .swift-version
  3. 0 38
      .travis.yml
  4. 13 8
      Package.swift
  5. 0 18
      Package@swift-4.swift
  6. 2 6
      Tests/Base32Tests/StringExtensionTests.swift

+ 16 - 73
.circleci/config.yml

@@ -1,42 +1,17 @@
 aliases:
-  - &store-test-results
-    path: build/reports/
-
-  - &restore-cocoapods-cache
-    key: cocoapods
-
-  - &save-cocoapods-cache
-    key: cocoapods
-    paths:
-      - ~/.cocoapods
-
-  - &steps-for-xcode-8
-    - checkout
-    - run: |
-        ( xcodebuild -scheme Base32 build-for-testing test-without-building # -sdk macosx -destination arch=x86_64
-          xcodebuild -scheme Base32 build-for-testing test-without-building -destination "name=iPhone 7"
-          xcodebuild -scheme Base32 build-for-testing test-without-building -destination "name=Apple TV 1080p"
-          xcodebuild -scheme Base32 build -destination "name=Apple Watch - 38mm"
-        ) | xcpretty -r junit
-    - store_test_results: *store-test-results
-    - restore_cache: *restore-cocoapods-cache
-    - run: pod lib lint
-    - save_cache: *save-cocoapods-cache
-
-  - &steps-for-xcode-9
-    - checkout
-    - run: |
-        ( export XCODE_FLAGS="-scheme Base32 SWIFT_VERSION=${SWIFT_VERSION}"
-          xcodebuild ${XCODE_FLAGS} test # -sdk macosx -destination arch=x86_64
-          xcodebuild ${XCODE_FLAGS} test -sdk iphonesimulator -destination "name=iPhone 8"
-          xcodebuild ${XCODE_FLAGS} test -sdk appletvsimulator -destination "name=Apple TV 4K"
-          xcodebuild ${XCODE_FLAGS} build -sdk watchsimulator -destination "name=Apple Watch Series 3 - 38mm"
-        ) | xcpretty -r junit
-    - store_test_results: *store-test-results
-    - restore_cache: *restore-cocoapods-cache
-    - run: pod lib lint --swift-version=${SWIFT_VERSION}
-    - save_cache: *save-cocoapods-cache
-    - run: bash <(curl -s https://codecov.io/bash)
+  - &xcode-9
+    steps:
+      - checkout
+      - run: |
+          ( xcodebuild -scheme Base32 test # -sdk macosx -destination arch=x86_64
+            xcodebuild -scheme Base32 test -sdk iphonesimulator -destination "name=iPhone 8"
+            xcodebuild -scheme Base32 test -sdk appletvsimulator -destination "name=Apple TV 4K"
+            xcodebuild -scheme Base32 build -sdk watchsimulator -destination "name=Apple Watch Series 3 - 38mm"
+          ) | xcpretty -r junit
+      - store_test_results:
+          path: build/reports/
+      - run: pod lib lint
+      - run: bash <(curl -s https://codecov.io/bash)
 
   - &steps-for-spm
     - checkout
@@ -45,43 +20,20 @@ aliases:
 version: 2
 jobs:
 
-  xcode_8.3.3:
-    macos:
-      xcode: "8.3.3"
-    steps: *steps-for-xcode-8
-
-  xcode_9_swift_3:
-    macos:
-      xcode: "9.0"
-    environment:
-      - SWIFT_VERSION: 3.0
-    steps: *steps-for-xcode-9
-
   xcode_9_swift_4:
     macos:
       xcode: "9.0"
-    environment:
-      - SWIFT_VERSION: 4.0
-    steps: *steps-for-xcode-9
+    <<: *xcode-9
 
   xcode_9.1_swift_4.0.2:
     macos:
       xcode: "9.1.0"
-    environment:
-      - SWIFT_VERSION: 4.0
-    steps: *steps-for-xcode-9
+    <<: *xcode-9
 
   xcode_9.2_swift_4.0.3:
     macos:
       xcode: "9.2.0"
-    environment:
-      - SWIFT_VERSION: 4.0
-    steps: *steps-for-xcode-9
-
-  spm_swift_3.1.1:
-    macos:
-      xcode: "8.3.3"
-    steps: *steps-for-spm
+    <<: *xcode-9
 
   spm_swift_4:
     macos:
@@ -98,11 +50,6 @@ jobs:
       xcode: "9.2.0"
     steps: *steps-for-spm
 
-  linux_swift_3.1.1:
-    docker:
-      - image: norionomura/swift:311
-    steps: *steps-for-spm
-
   linux_swift_4:
     docker:
       - image: norionomura/swift:40
@@ -122,16 +69,12 @@ workflows:
   version: 2
   workflow:
     jobs:
-      - xcode_8.3.3
-      - xcode_9_swift_3
       - xcode_9_swift_4
       - xcode_9.1_swift_4.0.2
       - xcode_9.2_swift_4.0.3
-      - spm_swift_3.1.1
       - spm_swift_4
       - spm_swift_4.0.2
       - spm_swift_4.0.3
-      - linux_swift_3.1.1
       - linux_swift_4
       - linux_swift_4.0.2
       - linux_swift_4.0.3

+ 1 - 1
.swift-version

@@ -1 +1 @@
-3.0
+4.0

+ 0 - 38
.travis.yml

@@ -1,38 +0,0 @@
-language: generic
-matrix:
-  include:
-  - script:
-    - set -o pipefail
-    - xcodebuild -scheme Base32 build-for-testing test-without-building | xcpretty
-    - xcodebuild -scheme Base32 build-for-testing test-without-building -destination "name=iPhone 7" | xcpretty
-    - xcodebuild -scheme Base32 build-for-testing test-without-building -destination "name=Apple TV 1080p" | xcpretty
-    - xcodebuild -scheme Base32 build -destination "name=Apple Watch - 38mm" | xcpretty
-    - swift test
-    - pod lib lint
-    env: JOB=macOS-Swift3.0.2
-    os: osx
-    osx_image: xcode8.2
-  - script:
-    - set -o pipefail
-    - xcodebuild -scheme Base32 build-for-testing test-without-building | xcpretty
-    - xcodebuild -scheme Base32 build-for-testing test-without-building -destination "name=iPhone 7" | xcpretty
-    - xcodebuild -scheme Base32 build-for-testing test-without-building -destination "name=Apple TV 1080p" | xcpretty
-    - xcodebuild -scheme Base32 build -destination "name=Apple Watch - 38mm" | xcpretty
-    - swift test
-    - pod lib lint
-    env: JOB=macOS-Swift3.1
-    os: osx
-    osx_image: xcode8.3
-    before_install:
-      - xcrun simctl delete 38C891AB-EC79-43E4-9311-6FDEB12DCF11 || true
-  - script: docker run -v `pwd`:`pwd` -w `pwd` swift:3.0.2 swift test
-    env: JOB=Linux-Swift3.0.2
-    sudo: required
-    services: docker
-  - script: docker run -v `pwd`:`pwd` -w `pwd` swift:3.1 swift test
-    env: JOB=Linux-Swift3.1
-    sudo: required
-    services: docker
-notifications:
-  webhooks:
-    secure: TKFWG5dDRlNK/XbsC7eKDEh7vnydCUYjGc1Sv9DUOfRjvxYBMq+ys8R9iHAotNNtnCdacohM0bcwT1ZXQcRTYKEd6vKtY1XkkPA2xBogLVfhu17DCDMhJ3iTtati1mMK1rVeSgseXffOKVq1ZjNGjBVCIHl0PZoj5jFiOwYKKO8=

+ 13 - 8
Package.swift

@@ -1,12 +1,17 @@
+// swift-tools-version:4.0
 import PackageDescription
 
-let package = Package(
+var package = Package(
     name: "Base32",
-    exclude: {
-        #if os(Linux)
-            return ["Tests/SecEncodeTransformTests"]
-        #else
-            return []
-        #endif
-    }()
+    products: [
+      .library(name: "Base32", targets: ["Base32"])
+    ],
+    targets: [
+        .target(name: "Base32"),
+        .testTarget(name: "Base32Tests", dependencies: ["Base32"])
+    ]
 )
+
+#if os(macOS)
+    package.targets.append(.testTarget(name: "SecEncodeTransformTests", dependencies: ["Base32"]))
+#endif

+ 0 - 18
Package@swift-4.swift

@@ -1,18 +0,0 @@
-// swift-tools-version:4.0
-import PackageDescription
-
-var package = Package(
-    name: "Base32",
-    products: [
-      .library(name: "Base32", targets: ["Base32"])
-    ],
-    targets: [
-        .target(name: "Base32"),
-        .testTarget(name: "Base32Tests", dependencies: ["Base32"])
-    ],
-    swiftLanguageVersions: [3, 4]
-)
-
-#if os(macOS)
-    package.targets.append(.testTarget(name: "SecEncodeTransformTests", dependencies: ["Base32"]))
-#endif

+ 2 - 6
Tests/Base32Tests/StringExtensionTests.swift

@@ -46,12 +46,8 @@ class StringExtensionTests: XCTestCase {
     }
 
     func test_dataUsingUTF8StringEncoding_empty() {
-        #if !os(Linux) || (os(Linux) && swift(>=3.1))
-            let emptyString = ""
-            XCTAssertEqual(emptyString.dataUsingUTF8StringEncoding, emptyString.data(using: .utf8, allowLossyConversion: false)!)
-        #else
-            print("\(#function) is skipped because that crashes on Swift 3.0.2 for Linux.")
-        #endif
+        let emptyString = ""
+        XCTAssertEqual(emptyString.dataUsingUTF8StringEncoding, emptyString.data(using: .utf8, allowLossyConversion: false)!)
     }
 }