Skip to content

Commit

Permalink
Only install swiftlint on Xcode 15 jobs (#3913)
Browse files Browse the repository at this point in the history
### Motivation

Better implementation of
#3909 and what was just
commited to `5.0-dev`

### Description

- Only install `swiftlint` on Xcode 15.3 jobs
- Also moved Ruby 3.2.2 install into `install-bundle-dependencies` which
was also done in `5.0-dev`
  • Loading branch information
joshdholtz authored May 18, 2024
1 parent c0c0a76 commit c6e185f
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 25 deletions.
78 changes: 56 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ aliases:
xcode_version:
type: string
default: '15.3'
install_swiftlint:
type: boolean
default: true
environment:
CIRCLECI_TESTS_GENERATE_SNAPSHOTS: << pipeline.parameters.generate_snapshots >>
CIRCLECI_TESTS_GENERATE_REVENUECAT_UI_SNAPSHOTS: << pipeline.parameters.generate_revenuecatui_snapshots >>
Expand Down Expand Up @@ -89,6 +92,18 @@ commands:
- restore_cache:
keys:
- v2-gem-cache-{{ checksum "Gemfile.lock" }}-{{ arch }}
# CircleCI images fail on Ruby 3.3
# https://github.com/fastlane/fastlane/issues/21794#issuecomment-2021331335
- run:
name: Set Ruby 3.2.2
command: |
eval "$(rbenv init -)"
rbenv install -s 3.2.2 # Replace with your required Ruby version
rbenv global 3.2.2
rbenv rehash
- run:
name: Verify Ruby version
command: ruby -v
- run:
name: Bundle install
working_directory: << parameters.directory >>
Expand All @@ -112,19 +127,10 @@ commands:
install_mint:
type: boolean
default: false
install_swiftlint:
type: boolean
default: true
steps:
# CircleCI images fail on Ruby 3.3
# https://github.com/fastlane/fastlane/issues/21794#issuecomment-2021331335
- run:
name: Set Ruby 3.2.2
command: |
eval "$(rbenv init -)"
rbenv install -s 3.2.2 # Replace with your required Ruby version
rbenv global 3.2.2
rbenv rehash
- run:
name: Verify Ruby version
command: ruby -v
- install-bundle-dependencies:
directory: << parameters.directory >>
- restore_cache:
Expand All @@ -135,13 +141,16 @@ commands:
steps:
- install-brew-dependency:
dependency_name: 'xcbeautify'
- install-brew-dependency:
dependency_name: 'swiftlint'
- when:
condition: << parameters.install_mint >>
steps:
- install-brew-dependency:
dependency_name: 'mint'
- when:
condition: << parameters.install_swiftlint >>
steps:
- install-brew-dependency:
dependency_name: "swiftlint"
- run: brew tap robotsandpencils/made
- save_cache:
key: homebrew-cache-{{ checksum "Brewfile.lock.json" }}-{{ arch }}
Expand Down Expand Up @@ -411,7 +420,8 @@ jobs:
<<: *base-job
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- run:
name: SPM RevenueCatUI Tests
Expand All @@ -436,7 +446,8 @@ jobs:
<<: *base-job
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- run:
name: SPM RevenueCatUI Release Build
Expand Down Expand Up @@ -470,7 +481,8 @@ jobs:
<<: *base-job
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- run:
name: SPM RevenueCatUI Release Build
Expand Down Expand Up @@ -544,7 +556,8 @@ jobs:
<<: *base-job
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- run:
name: Run tests
command: bundle exec fastlane test_ios
Expand All @@ -568,7 +581,8 @@ jobs:
<<: *base-job
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- run:
name: Run tests
Expand Down Expand Up @@ -598,7 +612,8 @@ jobs:
resource_class: macos.x86.medium.gen2
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- run:
name: Run tests
Expand Down Expand Up @@ -666,6 +681,7 @@ jobs:
- install-dependencies:
install_xcbeautify: false
install_mint: true
install_swiftlint: << parameters.install_swiftlint >>
- install-xcbeautify-for-xcode14
- update-spm-installation-commit
- install-runtime:
Expand Down Expand Up @@ -695,7 +711,8 @@ jobs:
resource_class: macos.x86.medium.gen2
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- install-runtime:
runtime-name: iOS 13.7
Expand Down Expand Up @@ -724,7 +741,8 @@ jobs:
resource_class: macos.x86.medium.gen2
steps:
- checkout
- install-dependencies
- install-dependencies:
install_swiftlint: << parameters.install_swiftlint >>
- update-spm-installation-commit
- install-runtime:
runtime-name: iOS 12.4
Expand Down Expand Up @@ -1149,23 +1167,30 @@ workflows:
xcode_version: '15.2'
- run-test-ios-16:
xcode_version: '14.3.0'
install_swiftlint: false
- run-test-ios-15:
xcode_version: '14.3.0'
install_swiftlint: false
- run-test-ios-14:
xcode_version: '14.2.0'
install_swiftlint: false
- run-test-ios-13:
xcode_version: '14.2.0'
install_swiftlint: false
- run-test-ios-12:
xcode_version: '14.2.0'
install_swiftlint: false
- run-test-macos

generate_revenuecatui_snapshots:
when: << pipeline.parameters.generate_revenuecatui_snapshots >>
jobs:
- spm-revenuecat-ui-ios-15:
xcode_version: '14.3.0'
install_swiftlint: false
- spm-revenuecat-ui-ios-16:
xcode_version: '14.3.0'
install_swiftlint: false
- spm-revenuecat-ui-ios-17:
xcode_version: '15.2'

Expand All @@ -1180,16 +1205,20 @@ workflows:
- lint
- spm-release-build-xcode-14:
xcode_version: '14.3.0'
install_swiftlint: false
- spm-release-build-xcode-15:
xcode_version: '15.2'
- spm-xcode-14-1:
xcode_version: '14.1.0'
install_swiftlint: false
- spm-custom-entitlement-computation-build
- spm-receipt-parser
- spm-revenuecat-ui-ios-15:
xcode_version: '14.3.0'
install_swiftlint: false
- spm-revenuecat-ui-ios-16:
xcode_version: '14.3.0'
install_swiftlint: false
- spm-revenuecat-ui-ios-17:
xcode_version: '15.2'
- spm-revenuecat-ui-watchos
Expand All @@ -1198,19 +1227,24 @@ workflows:
xcode_version: '15.2'
- run-test-ios-16:
xcode_version: '14.3.0'
install_swiftlint: false
- run-test-ios-15:
xcode_version: '14.3.0'
install_swiftlint: false
- run-test-watchos
- run-test-tvos
# Pre-iOS 15 requires macOS 12 which requires Xcode 14.2
# See https://circleci.com/docs/using-macos/#supported-xcode-versions
- run-test-ios-14:
xcode_version: '14.2.0'
install_swiftlint: false
- run-test-ios-13:
xcode_version: '14.2.0'
install_swiftlint: false
<<: *release-branches-and-main
- run-test-ios-12:
xcode_version: '14.2.0'
install_swiftlint: false
<<: *release-branches-and-main
- build-tv-watch-and-macos
- build-visionos
Expand Down
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ disabled_rules:
- blanket_disable_command
# Broken: https://github.com/realm/SwiftLint/issues/5153
- unneeded_synthesized_initializer
- non_optional_string_data_conversion
- static_over_final_class

custom_rules:
xctestcase_superclass:
Expand Down
1 change: 1 addition & 0 deletions Sources/Networking/HTTPClient/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ private extension HTTPClient {

let requestStartTime = self.dateProvider.now()

// swiftlint:disable:next redundant_void_return
let task = self.session.dataTask(with: urlRequest) { (data, urlResponse, error) -> Void in
self.handle(urlResponse: urlResponse,
request: request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension PromotionalOffer: Sendable {}
return self == other
}

// swiftlint:disable:next missing_docs
// swiftlint:disable:next missing_docs nsobject_prefer_isequal
public static func == (
lhs: PromotionalOffer.SignedData,
rhs: PromotionalOffer.SignedData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ internal struct SK2StoreProduct: StoreProductType {
@available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *)
private extension SK2StoreProduct {

// swiftlint:disable:next identifier_name
var _currencyCodeAndLocale: (code: String?, locale: Locale?) {
if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) {
let format = self.currencyFormat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private func checkTypealiases(
customerInfo: customerInfo,
userCancelled: userCancelled)

// swiftlint:disable:next line_length
// swiftlint:disable:next line_length redundant_void_return
let purchaseCompletedBlock: PurchaseCompletedBlock = { (_: StoreTransaction?, _: CustomerInfo?, _: Error?, _: Bool) -> Void in }

let startPurchaseBlock: StartPurchaseBlock = { (_: PurchaseCompletedBlock) in }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private func checkTypealiases(
customerInfo: customerInfo,
userCancelled: userCancelled)

// swiftlint:disable:next line_length
// swiftlint:disable:next line_length redundant_void_return
let purchaseCompletedBlock: PurchaseCompletedBlock = { (_: StoreTransaction?, _: CustomerInfo?, _: Error?, _: Bool) -> Void in }

let startPurchaseBlock: StartPurchaseBlock = { (_: PurchaseCompletedBlock) in }
Expand Down

0 comments on commit c6e185f

Please sign in to comment.