Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump XCode on CI #279

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Test

env:
afterpay-scheme: Afterpay
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.1.0.app/Contents/Developer

on:
push:
Expand All @@ -17,16 +17,16 @@ jobs:
runs-on: macos-latest

env:
destination: platform=iOS Simulator,name=iPhone 14,OS=16.4
destination: platform=iOS Simulator,name=iPhone 16,OS=18.1
example-scheme: Example
example-ui-test-scheme: ExampleUITests
workspace: Afterpay.xcworkspace

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Mint Packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /usr/local/lib/mint
key: ${{ runner.os }}-mint-${{ hashFiles('Mintfile') }}
Expand Down Expand Up @@ -62,13 +62,13 @@ jobs:
-destination '${{ env.destination }}'

- name: Checkout Example Server
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: afterpay/sdk-example-server
path: ./example-server

- name: Setup Example Server
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16

Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:

- name: Upload UI test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: xcresults
path: /Users/runner/Library/Developer/Xcode/DerivedData/Afterpay-*/Logs/Test/*
Expand All @@ -108,7 +108,7 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -129,7 +129,7 @@ jobs:
workspace: .swiftpm/xcode/package.xcworkspace

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Validate Swift Package
run: |
Expand Down
6 changes: 6 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ disabled_rules:
# force casting is a common part of UIKit development discretion is left to the developer
- force_cast
- function_body_length
- blanket_disable_command
- non_optional_string_data_conversion
- large_tuple
- switch_case_alignment
- orphaned_doc_comment
- unavailable_condition

opt_in_rules:
- indentation_width
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/Purchase/CheckoutPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public struct CustomButton: View {
.buttonStyle(CustomButtonStyle(isSelected: isSelected))
}

public init(_ text: String, isSelected: Bool, action: @escaping() -> Void) {
public init(_ text: String, isSelected: Bool, action: @escaping () -> Void) {
self.text = text
self.action = action
self.isSelected = isSelected
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/Purchase/PurchaseFlowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ final class PurchaseFlowController: UIViewController {
let viewControllers = [productsViewController, cashReceiptViewController]
navigationController.setViewControllers(viewControllers, animated: true)
case .showSuccessForV3WithCashAppPay(let message, let payload):
var alert = AlertFactory.alert(successMessage: message)
let alert = AlertFactory.alert(successMessage: message)
alert.message = [
"Card": payload.paymentDetails.virtualCard?.cardNumber,
"Valid until": RelativeDateTimeFormatter().string(for: payload.cardValidUntil),
Expand Down
1 change: 1 addition & 0 deletions Example/Example/Purchase/PurchaseLogicController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Foundation
import PayKit
import PayKitUI

// swiftlint:disable:next type_body_length
final class PurchaseLogicController {

enum Command {
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/Shared/WidgetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class WidgetViewController: UIViewController {
private var messageLabel = UILabel()
private var widgetView: WidgetView!

private let updateAmountField = Field(
private lazy var updateAmountField = Field(
text: "Total Amount:",
placeholder: "0.00",
keyboardType: .decimalPad,
Expand Down
21 changes: 0 additions & 21 deletions Example/ExampleUITests/ExampleUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,4 @@ final class ExampleUITests: XCTestCase {

app.buttons["Yes"].tap()
}

func testTokenlessWidgetAppears() throws {
app.buttons["Tokenless…"].tap()

_ = app.webViews.staticTexts.firstMatch.waitForExistence(timeout: 60)

let webViewText = app.webViews.staticTexts.firstMatch

XCTAssertTrue(webViewText.label.contains(#"token":null"#))
XCTAssertTrue(webViewText.label.contains(#"amount":"200.00"#))
XCTAssertTrue(webViewText.label.contains(#"currency":"USD"#))

let textField = app.textFields.firstMatch
textField.tap()
textField.typeText("444")
app.buttons["Update"].tap()

XCTAssertTrue(webViewText.label.contains(#""amount":"444""#))
XCTAssertTrue(webViewText.label.contains(#""currency":"USD""#))
}

}
2 changes: 1 addition & 1 deletion Mintfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
realm/SwiftLint@0.46.5
realm/SwiftLint@0.57.1
4 changes: 2 additions & 2 deletions Scripts/swiftlint-example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ unset SDKROOT
cd ..

./Tools/mint/mint run swiftlint \
--config .swiftlint.yml \
--quiet \
--path Example \
--config .swiftlint.yml
-- Example \
1 change: 1 addition & 0 deletions Scripts/swiftlint-sdk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ unset SDKROOT

if [ "$CARTHAGE" != "YES" ]; then
./Tools/mint/mint run swiftlint \
--config .swiftlint.yml \
--quiet \
-- \
Package.swift \
Expand Down
11 changes: 3 additions & 8 deletions Sources/Afterpay/ApiV3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ enum ApiV3 {

private static let decoder: JSONDecoder = {
let decoder = JSONDecoder()
let formatter = ISO8601DateFormatter()
let formatter = DateFormatter()

formatter.timeZone = TimeZone(abbreviation: "GMT")
formatter.formatOptions = [
.withInternetDateTime,
.withDashSeparatorInDate,
.withColonSeparatorInTime,
.withTimeZone,
.withFractionalSeconds,
]
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
decoder.dateDecodingStrategy = .custom { decoder in
let container = try decoder.singleValueContainer()
let string = try container.decode(String.self)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Afterpay/Checkout/CheckoutV2ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import Foundation
import os.log
import UIKit
import WebKit
@preconcurrency import WebKit

// swiftlint:disable:next colon type_body_length
// swiftlint:disable:next type_body_length
final class CheckoutV2ViewController:
UIViewController,
UIAdaptivePresentationControllerDelegate,
Expand Down
3 changes: 1 addition & 2 deletions Sources/Afterpay/Checkout/CheckoutV3ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
//

import UIKit
import WebKit
@preconcurrency import WebKit

// swiftlint:disable:next colon
final class CheckoutV3ViewController:
UIViewController,
UIAdaptivePresentationControllerDelegate,
Expand Down
3 changes: 1 addition & 2 deletions Sources/Afterpay/Checkout/CheckoutWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
//

import UIKit
import WebKit
@preconcurrency import WebKit

// swiftlint:disable:next colon
final class CheckoutWebViewController:
UIViewController,
UIAdaptivePresentationControllerDelegate,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Afterpay/Info/InfoWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import UIKit
import WebKit
@preconcurrency import WebKit

final class InfoWebViewController: UIViewController, WKNavigationDelegate {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Afterpay/Widget/WidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import UIKit
import WebKit
@preconcurrency import WebKit

public final class WidgetView: UIView, WKNavigationDelegate, WKScriptMessageHandler {

Expand Down