From 888619912f3a694eec7b2a7fa5f46418f9e8c002 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Fri, 10 Sep 2021 11:32:02 -0400 Subject: [PATCH] Run CI with Xcode 12.5.1 & Swift 5.4 (#3710) And require Swift 5.4 or Xcode 12.5 or later to build SwiftLint. --- CHANGELOG.md | 3 +- Makefile | 2 +- README.md | 2 +- README_CN.md | 2 +- README_KR.md | 2 +- .../Lint/UnusedDeclarationRuleExamples.swift | 6 ++-- .../SwiftVersionTests.swift | 2 ++ azure-pipelines.yml | 36 +++++++++---------- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 071ab7abfa..41f4377e7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ #### Breaking -* None. +* SwiftLint now requires Swift 5.4 or higher to build. + [JP Simard](https://github.com/jpsim) #### Experimental diff --git a/Makefile b/Makefile index cca1415440..bd0409e675 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ docker_image: docker build --force-rm --tag swiftlint . docker_test: - docker run -v `pwd`:`pwd` -w `pwd` --name swiftlint --rm swift:5.3 swift test --parallel + docker run -v `pwd`:`pwd` -w `pwd` --name swiftlint --rm swift:5.4 swift test --parallel docker_htop: docker run -it --rm --pid=container:swiftlint terencewestphal/htop || reset diff --git a/README.md b/README.md index 14dfb23bdd..55ab0b0393 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ running it. ### Installing from source: You can also build and install from source by cloning this project and running -`make install` (Xcode 12 or later). +`make install` (Xcode 12.5 or later). ## Usage diff --git a/README_CN.md b/README_CN.md index 4981ce7123..115072108a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -45,7 +45,7 @@ $ mint install realm/SwiftLint ### 编译源代码: -你也可以通过 Clone SwiftLint 的 Git 仓库到本地然后执行 `make install` (Xcode 11.4+) 编译源代码的方式来安装。 +你也可以通过 Clone SwiftLint 的 Git 仓库到本地然后执行 `make install` (Xcode 12.5+) 编译源代码的方式来安装。 ## 用法 diff --git a/README_KR.md b/README_KR.md index 7c0c1930c3..2bd03b7980 100644 --- a/README_KR.md +++ b/README_KR.md @@ -44,7 +44,7 @@ $ mint install realm/SwiftLint ### 소스를 직접 컴파일하는 경우: -본 프로젝트를 클론해서 빌드할 수도 있습니다. `make install` 명령을 사용합니다. (Xcode 11.4 이후 버전) +본 프로젝트를 클론해서 빌드할 수도 있습니다. `make install` 명령을 사용합니다. (Xcode 12.5 이후 버전) ## 사용 방법 diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRuleExamples.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRuleExamples.swift index 65e1e56435..5610868a35 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRuleExamples.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRuleExamples.swift @@ -25,10 +25,10 @@ struct UnusedDeclarationRuleExamples { } let changes = [Change.insert(0), .delete(0)] - changes.deletes() + _ = changes.deletes() """), Example(""" - struct Item {} + struct Item: Codable {} struct ResponseModel: Codable { let items: [Item] @@ -79,7 +79,7 @@ struct UnusedDeclarationRuleExamples { indirect case optional(Component?) } - @_functionBuilder + @resultBuilder struct ComponentBuilder { static func buildExpression(_ string: StaticString) -> Component { return .string(string) diff --git a/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift b/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift index 121a602dd8..9b378c78d6 100644 --- a/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift +++ b/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift @@ -6,6 +6,8 @@ final class SwiftVersionTests: XCTestCase { func testDetectSwiftVersion() { #if compiler(>=5.5.0) let version = "5.5.0" + #elseif compiler(>=5.4.2) + let version = "5.4.2" #elseif compiler(>=5.4.1) let version = "5.4.1" #elseif compiler(>=5.4.0) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ce8ffb3507..7b180e61a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,8 +8,8 @@ jobs: strategy: maxParallel: 10 matrix: - swift53: - containerImage: swift:5.3 + swift54: + containerImage: swift:5.4 container: $[ variables['containerImage'] ] steps: - script: swift test --parallel @@ -17,14 +17,12 @@ jobs: - job: Xcode pool: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' strategy: maxParallel: 10 matrix: - xcode12: - DEVELOPER_DIR: /Applications/Xcode_12.app - xcode124: - DEVELOPER_DIR: /Applications/Xcode_12.4.app + xcode125: + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - script: | sw_vers @@ -45,14 +43,12 @@ jobs: - job: SwiftPM pool: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' strategy: maxParallel: 10 matrix: - xcode12: - DEVELOPER_DIR: /Applications/Xcode_12.app - xcode124: - DEVELOPER_DIR: /Applications/Xcode_12.4.app + xcode125: + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - script: | sw_vers @@ -65,9 +61,9 @@ jobs: - job: CocoaPods pool: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' variables: - DEVELOPER_DIR: /Applications/Xcode_12.4.app + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - script: bundle install --path vendor/bundle displayName: bundle install @@ -78,18 +74,18 @@ jobs: - job: Analyze pool: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' variables: - DEVELOPER_DIR: /Applications/Xcode_12.4.app + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - script: make analyze displayName: Run SwiftLint Analyze - job: TSan pool: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' variables: - DEVELOPER_DIR: /Applications/Xcode_12.4.app + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - script: swift run --sanitize=thread swiftlint lint --lenient displayName: Pre-cache SwiftLint Run @@ -100,9 +96,9 @@ jobs: - job: jazzy pool: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' variables: - DEVELOPER_DIR: /Applications/Xcode_12.4.app + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - script: swift run swiftlint generate-docs displayName: Run swiftlint generate-docs