Skip to content

Commit

Permalink
Refactor FXIOS-10645 Update Bitrise to use XCode 16.1 (#23211)
Browse files Browse the repository at this point in the history
* Update Bitrise to use XCode 16.1

* Update npm vulnrability

* Add verbose to the swift command

* Try edge version

* Trying one thing

* Update error handling in script

* Remove edge version

* Run script twice

* Update focus

* Revert npm change

* Test remove shard script

* Fix unit tests

* Update simulator target

* Change simulator

* Disable some tests

* Compile and test Focus on Github Actions

* Use macos-15 runner

* Run Focus tests for supported iOS versions

* Revert to old workflow name

* Update workflow name

* Run Firefox smoke tests on Github Actions

* Could the device matter?

* Disable some more tests

* Update danger version

* Update package

* How about iPad mini

* How about using Github Actions to run old iOS versions?

* Remove the update address from the smoke test

---------

Co-authored-by: Laurie Marceau <[email protected]>
Co-authored-by: Clare So <[email protected]>
Co-authored-by: mbarone <[email protected]>
  • Loading branch information
4 people authored and isabelrios committed Dec 3, 2024
1 parent dc532b9 commit 89f5099
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 148 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/firefox-ios-ui-tests-previous-os.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: "Firefox UI Tests for iOS 15 & 16"
name: "Firefox UI Tests for iOS 15, 16 & 17"

on:
workflow_dispatch: {}
env:
browser: firefox-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcode_version: 16.1
ios_version: 18.1
ios_simulator_default: iPhone 16
xcodebuild_scheme: Fennec
xcodebuild_target: Client
test_results_directory: /Users/runner/tmp

jobs:
compile:
name: Compile
runs-on: macos-14
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down Expand Up @@ -54,13 +54,15 @@ jobs:

run-smoketests:
name: Run smoke tests
runs-on: macos-14
runs-on: macos-15
needs: compile
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- ios_version: 17.5
ios_simulator: iPhone 15
- ios_version: 16.4
ios_simulator: iPhone 14
- ios_version: 15.5
Expand All @@ -78,8 +80,6 @@ jobs:
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo rm -fr /Applications/Xcode_16*
sudo rm -fr /Applications/Xcode_14*
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/firefox-ios-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:

env:
browser: firefox-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcode_version: 16.1
ios_version: 18.1
ios_simulator_default: iPhone 16
xcodebuild_scheme: Fennec
xcodebuild_target: Client
test_results_directory: /Users/runner/tmp

jobs:
compile:
name: Compile
runs-on: macos-14
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
ios_simulator: ['iPhone 15 Plus', 'iPad Pro 13-inch (M4)']
ios_simulator: ['iPhone 16', 'iPad mini (A17 Pro)']
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/focus-ios-ui-tests-previous-os.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
name: Focus iOS 15 & 16 tests
name: Focus iOS 15, 16 & 17 tests
on:
workflow_dispatch:
schedule:
- cron: "0 7 * * 1,3,5"

env:
browser: focus-ios
xcode_version: 15.4
xcode_version: 16.1
test_results_directory: /Users/runner/tmp

jobs:
Focus-iOS-Tests:
name: Focus iOS
runs-on: macos-14
runs-on: macos-15
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- ios_version: 17.5
ios_simulator: iPhone 15
- ios_version: 16.4
ios_simulator: iPhone 14
- ios_version: 15.5
Expand All @@ -38,7 +40,7 @@ jobs:
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo rm -fr /Applications/Xcode_16*
sudo rm -fr /Applications/Xcode_15*
sudo rm -fr /Applications/Xcode_14*
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/focus-ios-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:

env:
browser: focus-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcode_version: 16.1
ios_version: 18.1
ios_simulator_default: iPhone 16
xcodebuild_scheme: Focus
xcodebuild_target: XCUITest
test_results_directory: /Users/runner/tmp

jobs:
compile:
name: Compile
runs-on: macos-14
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down Expand Up @@ -49,14 +49,14 @@ jobs:
retention-days: 2
run-tests:
name: Run tests
runs-on: macos-14
runs-on: macos-15
needs: compile
strategy:
fail-fast: false
max-parallel: 1
matrix:
xcodebuild_test_plan: ['SmokeTest'] # , 'FullFunctionalTests']
ios_simulator: [ 'iPhone 15', 'iPad Pro (12.9-inch) (6th generation)']
ios_simulator: [ 'iPhone 16', 'iPad (10th generation)']
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,60 +63,61 @@ final class ImageHandlerTests: XCTestCase {
XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
}

func testFavicon_whenSiteResourceNil_imageIsInBundle_noCachedImage_returnsBundleImage() async {
// provide this site url, since the cache key is "google" and default favicons are store with cacheKey as name
// in bundle
let siteURL = URL(string: "https://www.google.com")!
let subject = createSubject()
let model = SiteImageModel(id: UUID(), imageType: .favicon, siteURL: siteURL)
let image = await subject.fetchFavicon(imageModel: model)

let siteImageBundle = Bundle.allBundles.first {
return $0.bundleIdentifier?.contains("SiteImageView-resources") ?? false
}!
let expectedImage = UIImage(named: "google", in: siteImageBundle, with: nil)
XCTAssertEqual(expectedImage, image)
XCTAssertEqual(siteImageCache.cacheImageCalled, 0)
XCTAssertEqual(faviconFetcher.fetchImageSucceedCalled, 0)
XCTAssertEqual(faviconFetcher.fetchImageFailedCalled, 0)
XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
}

func testFavicon_whenSiteResourceNil_imageIsInBundle_cachedImagePresent_returnsBundleImage() async {
let siteURL = URL(string: "https://www.google.com")!
siteImageCache.image = UIImage()
let subject = createSubject()
let model = SiteImageModel(id: UUID(), imageType: .favicon, siteURL: siteURL)
let image = await subject.fetchFavicon(imageModel: model)

let siteImageBundle = Bundle.allBundles.first {
return $0.bundleIdentifier?.contains("SiteImageView-resources") ?? false
}!
let expectedImage = UIImage(named: "google", in: siteImageBundle, with: nil)
XCTAssertEqual(expectedImage, image)
XCTAssertEqual(siteImageCache.cacheImageCalled, 0)
XCTAssertEqual(faviconFetcher.fetchImageSucceedCalled, 0)
XCTAssertEqual(faviconFetcher.fetchImageFailedCalled, 0)
XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
}

func testFavicon_whenSiteResourceIsInBundle_returnsBundleImage() async {
let siteURL = URL(string: "https://www.facebook.com")!
let subject = createSubject()
let resource: SiteResource = .bundleAsset(name: "facebook", forRemoteResource: siteURL)
let model = SiteImageModel(id: UUID(), imageType: .favicon, siteURL: siteURL, siteResource: resource)
let image = await subject.fetchFavicon(imageModel: model)

let siteImageBundle = Bundle.allBundles.first {
return $0.bundleIdentifier?.contains("SiteImageView-resources") ?? false
}!
let expectedImage = UIImage(named: "facebook", in: siteImageBundle, with: nil)
XCTAssertEqual(expectedImage, image)
XCTAssertEqual(siteImageCache.cacheImageCalled, 0)
XCTAssertEqual(faviconFetcher.fetchImageSucceedCalled, 0)
XCTAssertEqual(faviconFetcher.fetchImageFailedCalled, 0)
XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
}
// TODO: FXIOS-10642, loading images from the bundle this way doesn't work in XCode 16
// func testFavicon_whenSiteResourceNil_imageIsInBundle_noCachedImage_returnsBundleImage() async {
// // provide this site url, since the cache key is "google" and default favicons are store with cacheKey as name
// // in bundle
// let siteURL = URL(string: "https://www.google.com")!
// let subject = createSubject()
// let model = SiteImageModel(id: UUID(), imageType: .favicon, siteURL: siteURL)
// let image = await subject.fetchFavicon(imageModel: model)
//
// let siteImageBundle = Bundle.allBundles.first {
// return $0.bundleIdentifier?.contains("SiteImageView-resources") ?? false
// }!
// let expectedImage = UIImage(named: "google", in: siteImageBundle, with: nil)
// XCTAssertEqual(expectedImage, image)
// XCTAssertEqual(siteImageCache.cacheImageCalled, 0)
// XCTAssertEqual(faviconFetcher.fetchImageSucceedCalled, 0)
// XCTAssertEqual(faviconFetcher.fetchImageFailedCalled, 0)
// XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
// }
//
// func testFavicon_whenSiteResourceNil_imageIsInBundle_cachedImagePresent_returnsBundleImage() async {
// let siteURL = URL(string: "https://www.google.com")!
// siteImageCache.image = UIImage()
// let subject = createSubject()
// let model = SiteImageModel(id: UUID(), imageType: .favicon, siteURL: siteURL)
// let image = await subject.fetchFavicon(imageModel: model)
//
// let siteImageBundle = Bundle.allBundles.first {
// return $0.bundleIdentifier?.contains("SiteImageView-resources") ?? false
// }!
// let expectedImage = UIImage(named: "google", in: siteImageBundle, with: nil)
// XCTAssertEqual(expectedImage, image)
// XCTAssertEqual(siteImageCache.cacheImageCalled, 0)
// XCTAssertEqual(faviconFetcher.fetchImageSucceedCalled, 0)
// XCTAssertEqual(faviconFetcher.fetchImageFailedCalled, 0)
// XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
// }
//
// func testFavicon_whenSiteResourceIsInBundle_returnsBundleImage() async {
// let siteURL = URL(string: "https://www.facebook.com")!
// let subject = createSubject()
// let resource: SiteResource = .bundleAsset(name: "facebook", forRemoteResource: siteURL)
// let model = SiteImageModel(id: UUID(), imageType: .favicon, siteURL: siteURL, siteResource: resource)
// let image = await subject.fetchFavicon(imageModel: model)
//
// let siteImageBundle = Bundle.allBundles.first {
// return $0.bundleIdentifier?.contains("SiteImageView-resources") ?? false
// }!
// let expectedImage = UIImage(named: "facebook", in: siteImageBundle, with: nil)
// XCTAssertEqual(expectedImage, image)
// XCTAssertEqual(siteImageCache.cacheImageCalled, 0)
// XCTAssertEqual(faviconFetcher.fetchImageSucceedCalled, 0)
// XCTAssertEqual(faviconFetcher.fetchImageFailedCalled, 0)
// XCTAssertEqual(letterImageGenerator.generateLetterImageCalled, 0)
// }

func testFavicon_whenNoImages_returnsFallbackLetterFavicon_forHardcodedFaviconURL() async {
let subject = createSubject()
Expand Down
21 changes: 15 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/nerdishbynature/octokit.swift",
"state" : {
"revision" : "f762f1566f7cd0e683b9329f169c28ab6ef993cc",
"version" : "0.12.0"
"revision" : "44192458beb89180c3a3a1245d904aacac8be0ae",
"version" : "0.13.0"
}
},
{
"identity" : "requestkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nerdishbynature/RequestKit.git",
"state" : {
"revision" : "8b0258ea2a4345cbcac90509b764faacea12efb0",
"version" : "3.2.1"
"revision" : "e4d905fed938807e36d87f28375f88b7c1c26840",
"version" : "3.3.0"
}
},
{
"identity" : "swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/danger/swift.git",
"state" : {
"revision" : "21b074b1292286c9e90688fffa33d64d492f0520",
"version" : "3.16.0"
"revision" : "e43a19617fc905ef303b1af2f0449b99fc6ea0f2",
"version" : "3.20.2"
}
},
{
"identity" : "swiftformat",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nicklockwood/SwiftFormat",
"state" : {
"revision" : "c4d0bc2ec8aa41d4fe622771935247d74ff2e718",
"version" : "0.55.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let package = Package(
.library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"]), // dev
],
dependencies: [
.package(url: "https://github.com/danger/swift.git", exact: "3.16.0"), // dev
.package(url: "https://github.com/danger/swift.git", exact: "3.20.2"), // dev
.package(url: "https://github.com/f-meloni/danger-swift-coverage", exact: "1.2.1") // dev
],
targets: [
Expand Down
Loading

0 comments on commit 89f5099

Please sign in to comment.