Skip to content

Commit

Permalink
Fix broken CI workflows (v4) (#1948)
Browse files Browse the repository at this point in the history
## Summary

- Updated workflow runners to `macos-14-xlarge`.
- Upgraded device destinations in all affected jobs.
- Modified `Coder` to output using `sortedKeys`.
- Defined `encodeWithSortedKeys` in `JSONEncoder`.
- Fixed unit tests broken by updates in Swift 6 and Xcode 16.

## Issue

GitHub Actions deprecated the `macos-12` runners, causing workflows
relying on them to fail. To restore functionality, we've updated to
newer runners. This update also necessitated upgrading the selected
Xcode version and device destinations in the jobs. Additionally, some
unit tests were broken due to changes in the latest Xcode version, which
have now been fixed.

## Ticket

<ticket>
COIOS-000
</ticket>
  • Loading branch information
nauaros authored Jan 21, 2025
2 parents 6e5b94b + fa30798 commit c1e8eda
Show file tree
Hide file tree
Showing 31 changed files with 212 additions and 133 deletions.
40 changes: 28 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,36 @@ on:
jobs:

tests:
runs-on: macos-12
runs-on: macos-14-xlarge
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- destination: 'name=iPhone 11 Pro'
scheme: AdyenUIHost
- destination: 'name=iPhone-6,OS=11.4'
scheme: AdyenUIHost
- destination: 'name=iPhone-X,OS=12.4'
scheme: AdyenUIKitTests
- destination: 'name=iPhone 8,OS=13.7'
scheme: AdyenUIHost

- version: '18.1'
runtime: 'iOS-18-1'
device: 'iPhone 16'
displayname: 'iPhone-16'
os: 'macos-14-xlarge'
xcode_version: '16.1'
needs_custom_sim: false # Takes the shipped simulator that comes with Xcode 16

- version: '18.1'
runtime: 'iOS-18-1'
device: 'iPad (10th generation)'
displayname: 'iPad-10th-generation'
os: 'macos-14-xlarge'
xcode_version: '16.1'
needs_custom_sim: false # Takes the shipped simulator that comes with Xcode 16

- version: '16.4'
runtime: 'iOS-16-4'
device: 'iPhone 14'
displayname: 'iPhone-14'
os: 'macos-14-xlarge'
xcode_version: '16.1'
needs_custom_sim: false # Takes the shipped simulator that comes with Xcode 16
steps:
- uses: actions/checkout@v3
- uses: n1hility/cancel-previous-runs@v3
Expand Down Expand Up @@ -65,12 +81,12 @@ jobs:
destination: ${{ matrix.destination }}

sonar:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '11'
java-version: '17'

- name: Install Dependencies
run: |
Expand All @@ -84,7 +100,7 @@ jobs:
project: 'Adyen.xcodeproj'
params: '-derivedDataPath ./DerivedData -enableCodeCoverage YES'
scheme: AdyenUIHost
destination: 'name=iPhone 11'
destination: 'name=iPhone 16'

- name: Slather
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/format_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [workflow_dispatch]
jobs:

Update:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Format project
run: |
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/pr_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ on:
types: [opened, synchronize, reopened]

jobs:

build:
env:
sonarToken: ${{ secrets.SONAR_TOKEN }}
runs-on: macos-12
destination: "name=iPhone 16 Pro,OS=18.1"
project: "Adyen.xcodeproj"
params: "-derivedDataPath ./DerivedData -skipPackagePluginValidation"
runs-on: macos-14-xlarge

steps:
- uses: actions/checkout@v3
Expand All @@ -18,12 +21,12 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v1
with:
java-version: '11'
java-version: '17'

- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Install Tools
run: |
Expand All @@ -43,11 +46,8 @@ jobs:
xcodebuild -version
xcodebuild clean build test -project "${project}" -scheme "${scheme}" ${params} -destination "${destination}" | xcpretty && exit ${PIPESTATUS[0]}
env:
project: 'Adyen.xcodeproj'
params: '-derivedDataPath ./DerivedData -enableCodeCoverage YES'
params: '${{env.params}}'
scheme: 'AdyenUIHost'
destination: 'name=iPhone 11'

- name: Slather
run: |
slather coverage --sonarqube-xml ${params} ${project}
Expand All @@ -68,6 +68,7 @@ jobs:

- name: SwiftLint
run: |
brew install swiftlint
fastlane run swiftlint output_file:"./reports/swiftlint.json" reporter:"json" ignore_exit_status:"true"
- name: Run Sonar
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publich_podspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ on: [workflow_dispatch]
jobs:

publish:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3

- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Publish Adyen.podspec
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-demo-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [workflow_dispatch]
jobs:

Publish:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Install the Apple certificate and provisioning profile
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/regenerate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [workflow_dispatch]
jobs:

Generate:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Generate Docs
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:

setup:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
- uses: n1hility/cancel-previous-runs@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-SPM-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:

SPM:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
- uses: n1hility/cancel-previous-runs@v3
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Test Swift Package Manager Integration
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test-carthage-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,28 @@ on:
jobs:

carthage:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Resolve dependencies
run: |
brew update
brew install xcodegen
brew install carthage
brew upgrade carthage
- name: Test Carthage Integration
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
carthage version
Scripts/test-carthage-integration.sh
Scripts/test-carthage-integration.sh
11 changes: 7 additions & 4 deletions .github/workflows/test_cocoapods_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ on:
jobs:

pods:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Lint Cocoapods
run: |
brew update
brew install xcodegen
gem install cocoapods -v 1.10.2
pod repo update
pod lib lint Adyen.podspec --allow-warnings --verbose
- name: Test Cocoapods Integration
run: |
Scripts/test-CocoaPods-integration.sh -w
Scripts/test-CocoaPods-integration.sh
Scripts/test-CocoaPods-integration.sh
4 changes: 2 additions & 2 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:

Update:
runs-on: macos-12
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Select latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '16.1'

- name: Update version number
run: |
Expand Down
4 changes: 4 additions & 0 deletions Adyen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
C978F5EF2732CD6A00F59B3C /* FormCardSecurityCodeItemViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C978F5EE2732CD6A00F59B3C /* FormCardSecurityCodeItemViewTests.swift */; };
C982FFD826946F0800AED849 /* AffirmComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C982FFD726946F0800AED849 /* AffirmComponent.swift */; };
C982FFDC2694792F00AED849 /* AffirmPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = C982FFDB2694792F00AED849 /* AffirmPaymentMethod.swift */; };
C9B506C32D3E776200AAE686 /* JSONEncoder+SortedKeys.swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B506C22D3E776200AAE686 /* JSONEncoder+SortedKeys.swift.swift */; };
C9BB460427622D9B00E6730B /* BACSConfirmationViewProtocolMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB460327622D9B00E6730B /* BACSConfirmationViewProtocolMock.swift */; };
C9BB460627622E9600E6730B /* BACSConfirmationPresenterProtocolMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB460527622E9600E6730B /* BACSConfirmationPresenterProtocolMock.swift */; };
C9BB460927622F4100E6730B /* BACSConfirmationPresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB460827622F4100E6730B /* BACSConfirmationPresenterTests.swift */; };
Expand Down Expand Up @@ -1066,6 +1067,7 @@
C978F5EE2732CD6A00F59B3C /* FormCardSecurityCodeItemViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormCardSecurityCodeItemViewTests.swift; sourceTree = "<group>"; };
C982FFD726946F0800AED849 /* AffirmComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AffirmComponent.swift; sourceTree = "<group>"; };
C982FFDB2694792F00AED849 /* AffirmPaymentMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AffirmPaymentMethod.swift; sourceTree = "<group>"; };
C9B506C22D3E776200AAE686 /* JSONEncoder+SortedKeys.swift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JSONEncoder+SortedKeys.swift.swift"; sourceTree = "<group>"; };
C9BB460327622D9B00E6730B /* BACSConfirmationViewProtocolMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BACSConfirmationViewProtocolMock.swift; sourceTree = "<group>"; };
C9BB460527622E9600E6730B /* BACSConfirmationPresenterProtocolMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BACSConfirmationPresenterProtocolMock.swift; sourceTree = "<group>"; };
C9BB460827622F4100E6730B /* BACSConfirmationPresenterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BACSConfirmationPresenterTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2661,6 +2663,7 @@
E736497E25277B6500AB76AE /* StringExtension.swift */,
E736498125277B9100AB76AE /* DataExtension.swift */,
E736498325277BAA00AB76AE /* IntegerExtension.swift */,
C9B506C22D3E776200AAE686 /* JSONEncoder+SortedKeys.swift.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -5461,6 +5464,7 @@
E74517A425FB834C000BDCCF /* EncryptedCard.swift in Sources */,
F9F1A98F26CD15C30005CB1D /* RSAOAEP256Algorithm.swift in Sources */,
A0414C342791D9EC00DF3FE9 /* BankDetailsEncryptor.swift in Sources */,
C9B506C32D3E776200AAE686 /* JSONEncoder+SortedKeys.swift.swift in Sources */,
F9F1A98926CD0CCF0005CB1D /* CommonCryptoHelpers.swift in Sources */,
E745179925FB8340000BDCCF /* Card.swift in Sources */,
F92326BD25A366D9002C5BC4 /* CardPayload.swift in Sources */,
Expand Down
8 changes: 4 additions & 4 deletions Adyen/Core/Components/Base/Component.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2022 Adyen N.V.
// Copyright (c) 2019 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//
Expand Down Expand Up @@ -78,9 +78,9 @@ public extension Component {
}

private enum AssociatedKeys {
internal static var isDropIn = "isDropInObject"
internal static var isDropIn: Void?

internal static var environment = "environmentObject"
internal static var environment: Void?

internal static var clientKey = "clientKeyObject"
internal static var clientKey: Void?
}
6 changes: 3 additions & 3 deletions Adyen/Core/Components/Base/PaymentComponent.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2022 Adyen N.V.
// Copyright (c) 2019 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//
Expand Down Expand Up @@ -96,7 +96,7 @@ extension PaymentAwareComponent {

private enum AssociatedKeys {

internal static var payment = "paymentObject"
internal static var payment: Void?

internal static var order = "orderObject"
internal static var order: Void?
}
2 changes: 1 addition & 1 deletion Adyen/Helpers/UIViewAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import UIKit

private enum AssociatedKeys {
internal static var animations = "animations"
internal static var animations: Void?
}

/// :nodoc:
Expand Down
4 changes: 2 additions & 2 deletions Adyen/UI/Form/Items/Address/AddressViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2022 Adyen N.V.
// Copyright (c) 2021 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//
Expand Down Expand Up @@ -49,7 +49,7 @@ public struct AddressViewModel {
/// :nodoc:
public private(set) var schema: [FormScheme]

// swiftlint:disable function_body_length explicit_acl
// swiftlint:disable function_body_length
internal static subscript(context: AddressViewModelBuilderContext) -> AddressViewModel {
var viewModel = AddressViewModel(labels: [.city: .cityFieldTitle,
.houseNumberOrName: .houseNumberFieldTitle,
Expand Down
Loading

0 comments on commit c1e8eda

Please sign in to comment.