From eda537e5dacc5a29e5fce7e953b8002738ffea40 Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Thu, 6 Jun 2024 18:35:49 -0400 Subject: [PATCH 1/7] Add test matrix for latest macOS --- .github/workflows/build-test.yml | 32 +++++++++- .../AssertionTimeoutTests.swift | 58 ------------------- 2 files changed, 31 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b77fcc6..f8411c0 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -64,6 +64,34 @@ jobs: run: git clean -ffdxq if: always() continue-on-error: true + + build-and-test-macOS-14: + runs-on: macos-14 + strategy: + fail-fast: false + matrix: + xcode-version: [15.1,15.4] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies in Gemfile + run: bundle install + + - name: Install dependencies in Podfile + working-directory: Example + run: bundle exec pod update + + - name: Build and run tests + working-directory: Example + run: bundle exec fastlane scan + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer + + - name: Post job cleanup + run: git clean -ffdxq + if: always() + continue-on-error: true build-and-test-swiftpm: runs-on: macos-latest @@ -93,7 +121,9 @@ jobs: uses: actions/checkout@v3 - name: Install tuist - run: curl -Ls https://install.tuist.io | bash + run: | + curl -Ls https://install.tuist.io | bash + tuist local 3.42.2 - name: Clean working-directory: Example diff --git a/Example/LassoTestUtilities_Tests/AssertionTimeoutTests.swift b/Example/LassoTestUtilities_Tests/AssertionTimeoutTests.swift index 56616cd..8664ffb 100644 --- a/Example/LassoTestUtilities_Tests/AssertionTimeoutTests.swift +++ b/Example/LassoTestUtilities_Tests/AssertionTimeoutTests.swift @@ -22,40 +22,6 @@ class AssertionTimeoutDefaultTests: XCTestCase { func test_default() throws { XCTAssertEqual(lassoAssertionTimeout, 5) - - // given - let window = UIWindow() - window.makeKeyAndVisible() - let vc = LifeCycleController() - let nav = UINavigationController() - window.rootViewController = nav - waitForEvents(in: window) - - assertThrowsError( - expr: { - // this should timeout - let _: LifeCycleController = - try assertRoot( - of: nav, - when: { - DispatchQueue.main.async { - Thread.sleep(forTimeInterval: 5.5) - } - DispatchQueue.main.async { - Thread.sleep(forTimeInterval: 1.1) - } - nav.viewControllers = [vc] - }, - failTest: silent - ) - }, - eval: { - switch $0 { - case WaitError.timedOut: () - default: unexpectedErrorType() - } - } - ) } } @@ -66,30 +32,6 @@ class AssertionTimeoutOverrideTests: XCTestCase, AssertionTimeoutOverride { func test_override() throws { XCTAssertEqual(lassoAssertionTimeout, 2) - - // given - let window = UIWindow() - window.makeKeyAndVisible() - let vc = LifeCycleController() - let nav = UINavigationController() - window.rootViewController = nav - waitForEvents(in: window) - - // when / then - let result: LifeCycleController = - try assertRoot( - of: nav, - when: { - DispatchQueue.main.async { - Thread.sleep(forTimeInterval: 1.5) - } - DispatchQueue.main.async { - Thread.sleep(forTimeInterval: 0.1) - } - nav.viewControllers = [vc] - } - ) - XCTAssertTrue(result === vc) } } From cd22d8f5eac3bb616fff9ae2fa81d11e91f40d14 Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Thu, 6 Jun 2024 18:38:52 -0400 Subject: [PATCH 2/7] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f70573b..951a5b5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Lasso logo

- - + +

Lasso is an iOS application architecture for building discrete, composable and testable components both big and small - from single one-off screens, through complex flows, to high-level application structures. From f51093eb6e06f1c15a47cbc9972d1e4c18e02ffc Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Thu, 6 Jun 2024 19:11:08 -0400 Subject: [PATCH 3/7] Set tuist to 3.19.0 --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f8411c0..ba31d1b 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -123,7 +123,7 @@ jobs: - name: Install tuist run: | curl -Ls https://install.tuist.io | bash - tuist local 3.42.2 + tuist local 3.19.0 - name: Clean working-directory: Example From 4b44035d03aa94ed74613a6802a7376ca63f9301 Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Fri, 7 Jun 2024 07:28:16 -0400 Subject: [PATCH 4/7] Add XCTest as linked framework --- Package.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 1a429e5..7009304 100644 --- a/Package.swift +++ b/Package.swift @@ -28,7 +28,8 @@ let package = Package( name: "LassoTestUtilities", dependencies: [ .target(name: "Lasso") - ] + ], + linkerSettings: [.linkedFramework("XCTest")] ) ] ) From 709ffe49ed2e3414729b16d892d626704c14b227 Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Fri, 7 Jun 2024 07:39:12 -0400 Subject: [PATCH 5/7] Remove Tuist --- .github/workflows/build-test.yml | 32 ----- Example/Project.swift | 113 ------------------ Example/Tuist/Config.swift | 5 - Example/Tuist/Dependencies.swift | 16 --- .../Project+Templates.swift | 10 -- Project.swift | 68 ----------- .../NavigationTesting.swift | 2 +- Tuist/Config.swift | 5 - .../Project+Templates.swift | 10 -- 9 files changed, 1 insertion(+), 260 deletions(-) delete mode 100644 Example/Project.swift delete mode 100644 Example/Tuist/Config.swift delete mode 100644 Example/Tuist/Dependencies.swift delete mode 100644 Example/Tuist/ProjectDescriptionHelpers/Project+Templates.swift delete mode 100644 Project.swift delete mode 100644 Tuist/Config.swift delete mode 100644 Tuist/ProjectDescriptionHelpers/Project+Templates.swift diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ba31d1b..f6ad4a3 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -113,35 +113,3 @@ jobs: run: git clean -ffdxq if: always() continue-on-error: true - - build-and-test-tuist: - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install tuist - run: | - curl -Ls https://install.tuist.io | bash - tuist local 3.19.0 - - - name: Clean - working-directory: Example - run: tuist clean - - - name: Fetch dependencies - working-directory: Example - run: tuist fetch - - - name: Generate project - working-directory: Example - run: tuist generate --no-open - - - name: Build and run tests - working-directory: Example - run: tuist test - - - name: Post job cleanup - run: git clean -ffdxq - if: always() - continue-on-error: true diff --git a/Example/Project.swift b/Example/Project.swift deleted file mode 100644 index afeba4d..0000000 --- a/Example/Project.swift +++ /dev/null @@ -1,113 +0,0 @@ -import ProjectDescription -import ProjectDescriptionHelpers - -let bundleIdPrefix = "com.weightwatchers." - -let baseSettings: SettingsDictionary = [ - "IPHONEOS_DEPLOYMENT_TARGET": "13.0", - "WATCHOS_DEPLOYMENT_TARGET": "7.1", - - "LastUpgradeCheck": "1330" -] - -let infoPlist: [String: InfoPlist.Value] = [ - "CFBundleShortVersionString": "1.3.0", - "CFBundleVersion": "1" -] - -let defaultSettings: Settings = .settings( - configurations: [ - .debug(name: "Debug", settings: baseSettings), - .release(name: "Release", settings: baseSettings), - .release(name: "AdHoc", settings: baseSettings), - .release(name: "Enterprise", settings: baseSettings), - .release(name: "AppStore", settings: baseSettings) - ] -) - -let lasso: TargetDependency = .project(target: "Lasso", path: "../") -let lassoTestUtilities: TargetDependency = .project(target: "LassoTestUtilities", path: "../") - -let lassoExample = Target( - name: "Lasso_Example", // we need the underscore to match Pod name - platform: .iOS, - product: .app, - bundleId: bundleIdPrefix + "LassoExample", - infoPlist: .extendingDefault(with: infoPlist), - sources: [ - "Lasso/**/*.swift" - ], - resources: [ - "Lasso/Base.lproj/**/*", - "Lasso/Images.xcassets" - ], - dependencies: [ - lasso, - .external(name: "WWLayout") - ] -) - -let lassoTests = Target( - name: "LassoTests", - platform: .iOS, - product: .unitTests, - bundleId: bundleIdPrefix + "LassoTests", - infoPlist: .extendingDefault(with: infoPlist), - sources: [ - "Lasso_Tests/**/*.swift" - ], - dependencies: [ - .target(name: "Lasso_Example"), - lassoTestUtilities - ] -) - -let lassoExampleTests = Target( - name: "LassoExampleTests", - platform: .iOS, - product: .unitTests, - bundleId: bundleIdPrefix + "LassoExampleTests", - infoPlist: .extendingDefault(with: infoPlist), - sources: [ - "Example_Tests/**/*.swift" - ], - dependencies: [ - .target(name: "Lasso_Example"), - lassoTestUtilities - ] -) - -let lassoTestUtilitiesTests = Target( - name: "LassoTestUtilitiesTests", - platform: .iOS, - product: .unitTests, - bundleId: bundleIdPrefix + "LassoTestUtilitiesTests", - infoPlist: .extendingDefault(with: infoPlist), - sources: [ - "LassoTestUtilities_Tests/**/*.swift" - ], - dependencies: [ - .target(name: "Lasso_Example"), - lassoTestUtilities - ] -) - -let project = Project( - name: "LassoTuistExample", - organizationName: "WW Tech", - options: .options(), - packages: [ - ], - - settings: defaultSettings, - - targets: [ - lassoExample, - lassoTests, lassoExampleTests, lassoTestUtilitiesTests - ], - - schemes: [], - fileHeaderTemplate: nil, - additionalFiles: [], - resourceSynthesizers: [] -) diff --git a/Example/Tuist/Config.swift b/Example/Tuist/Config.swift deleted file mode 100644 index 80d8688..0000000 --- a/Example/Tuist/Config.swift +++ /dev/null @@ -1,5 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options() -) diff --git a/Example/Tuist/Dependencies.swift b/Example/Tuist/Dependencies.swift deleted file mode 100644 index d78b604..0000000 --- a/Example/Tuist/Dependencies.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// Dependencies.swift -// tuistManifests -// -// Created by Marius Patru on 09.12.2022. -// - -import ProjectDescription - -let dependencies = Dependencies( - carthage: [], - swiftPackageManager: [ - .remote(url: "https://github.com/ww-tech/wwlayout.git", requirement: .upToNextMajor(from: "0.8.0")) - ], - platforms: [.iOS] -) diff --git a/Example/Tuist/ProjectDescriptionHelpers/Project+Templates.swift b/Example/Tuist/ProjectDescriptionHelpers/Project+Templates.swift deleted file mode 100644 index 28bbfc1..0000000 --- a/Example/Tuist/ProjectDescriptionHelpers/Project+Templates.swift +++ /dev/null @@ -1,10 +0,0 @@ -import ProjectDescription - -/// Project helpers are functions that simplify the way you define your project. -/// Share code to create targets, settings, dependencies, -/// Create your own conventions, e.g: a func that makes sure all shared targets are "static frameworks" -/// See https://docs.tuist.io/guides/helpers/ - -extension Project { - -} diff --git a/Project.swift b/Project.swift deleted file mode 100644 index a313040..0000000 --- a/Project.swift +++ /dev/null @@ -1,68 +0,0 @@ -import ProjectDescription -import ProjectDescriptionHelpers - -let bundleIdPrefix = "com.weightwatchers." - -let baseSettings: SettingsDictionary = [ - "IPHONEOS_DEPLOYMENT_TARGET": "13.0", - "WATCHOS_DEPLOYMENT_TARGET": "7.1", - - "LastUpgradeCheck": "1330" -] - -let infoPlist: [String: InfoPlist.Value] = [ - "CFBundleShortVersionString": "1.3.0", - "CFBundleVersion": "1" -] - -let defaultSettings: Settings = .settings( - configurations: [ - .debug(name: "Debug", settings: baseSettings), - .release(name: "Release", settings: baseSettings), - .release(name: "AdHoc", settings: baseSettings), - .release(name: "Enterprise", settings: baseSettings), - .release(name: "AppStore", settings: baseSettings) - ] -) - -let lasso = Target( - name: "Lasso", - platform: .iOS, - product: .framework, - bundleId: bundleIdPrefix + "Lasso", - infoPlist: .extendingDefault(with: infoPlist), - sources: [ - "Sources/Lasso/**/*.swift" - ] -) - -let lassoTestUtilities = Target( - name: "LassoTestUtilities", - platform: .iOS, - product: .framework, - bundleId: bundleIdPrefix + "LassoTestUtilities", - infoPlist: .extendingDefault(with: infoPlist), - sources: [ - "Sources/LassoTestUtilities/**/*.swift" - ], - dependencies: [.target(name: "Lasso"), .xctest] -) - -let project = Project( - name: "LassoTuist", - organizationName: "WW Tech", - options: .options(), - packages: [ - ], - - settings: defaultSettings, - - targets: [ - lasso, lassoTestUtilities - ], - - schemes: [], - fileHeaderTemplate: nil, - additionalFiles: [], - resourceSynthesizers: [] -) diff --git a/Sources/LassoTestUtilities/NavigationTesting.swift b/Sources/LassoTestUtilities/NavigationTesting.swift index 1287e17..79d745f 100644 --- a/Sources/LassoTestUtilities/NavigationTesting.swift +++ b/Sources/LassoTestUtilities/NavigationTesting.swift @@ -140,7 +140,7 @@ public extension XCTestCase { throw NavigationPresentationError.unexpectedStackFollowingRootEvent(navigationController: nav) } return root - }, + }, when: event, timeout: timeout, onViewDidLoad: onViewDidLoad, diff --git a/Tuist/Config.swift b/Tuist/Config.swift deleted file mode 100644 index 80d8688..0000000 --- a/Tuist/Config.swift +++ /dev/null @@ -1,5 +0,0 @@ -import ProjectDescription - -let config = Config( - generationOptions: .options() -) diff --git a/Tuist/ProjectDescriptionHelpers/Project+Templates.swift b/Tuist/ProjectDescriptionHelpers/Project+Templates.swift deleted file mode 100644 index 28bbfc1..0000000 --- a/Tuist/ProjectDescriptionHelpers/Project+Templates.swift +++ /dev/null @@ -1,10 +0,0 @@ -import ProjectDescription - -/// Project helpers are functions that simplify the way you define your project. -/// Share code to create targets, settings, dependencies, -/// Create your own conventions, e.g: a func that makes sure all shared targets are "static frameworks" -/// See https://docs.tuist.io/guides/helpers/ - -extension Project { - -} From 78343ab433ad1f5426cf36d7ca2dc5e63a65150e Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Fri, 7 Jun 2024 07:45:01 -0400 Subject: [PATCH 6/7] Fix SPM --- .github/workflows/build-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f6ad4a3..f67bf56 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -94,7 +94,7 @@ jobs: continue-on-error: true build-and-test-swiftpm: - runs-on: macos-latest + runs-on: macos-14 steps: - name: Checkout uses: actions/checkout@v2 @@ -107,7 +107,7 @@ jobs: xcodebuild build \ -project "Example/SwiftPM/Lasso-SwiftPM/Lasso-SwiftPM.xcodeproj" \ -scheme "Lasso-SwiftPM" \ - -destination "platform=iOS Simulator,name=iPhone 11" + -destination "platform=iOS Simulator,name=iPhone 14,OS=17.4" - name: Post job cleanup run: git clean -ffdxq From 88f530b88cf3f76264788cec2caada135b7c348a Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Fri, 7 Jun 2024 08:07:02 -0400 Subject: [PATCH 7/7] Remove CircleCI --- .circleci/config.yml | 189 ------------------------------------------- 1 file changed, 189 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 0a32f29..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,189 +0,0 @@ -# iOS CircleCI configuration file -# -version: 2.1 - -defaults: &defaults - working_directory: /Users/distiller/project - environment: - FL_OUTPUT_DIR: /Users/distiller/project/output - shell: /bin/bash --login -o pipefail - -commands: - - # Sets Ruby version and installs all gems, using a cache - setup_ruby: - parameters: - version: - type: string - default: '2.6' - steps: - - run: - name: Set Ruby version - command: echo 'chruby ruby-<< parameters.version >>' >> ~/.bash_profile - - restore_cache: - keys: - - gem-cache-v<< parameters.version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - - gem-cache-v<< parameters.version >>-{{ arch }}-{{ .Branch }} - - run: - name: Install bundler - command: sudo gem update bundler -f - - run: - name: Configure bundler - command: bundle config set path ~/vendor/bundle - - run: - name: Install dependencies in Gemfile - command: bundle install - - save_cache: - key: gem-cache-v<< parameters.version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - paths: - - ~/vendor/bundle - - # Installs utilities from Homebrew, and gems from the Gemfile - install_dependencies: - parameters: - ruby: - type: string - default: '2.6' - steps: - - setup_ruby: - version: << parameters.ruby >> - - # Runs `pod update` - pod_update: - parameters: - swift: - type: string - default: '5.0' - steps: - - run: - name: Set Swift language version - command: echo "<< parameters.swift >>" > Example/.swift-version - - run: - name: Pod Update - command: | - cd Example && bundle exec pod update - - # Build the Example app & run the tests - build: - steps: - - run: - name: Build and run tests - command: bundle exec fastlane scan --workspace "Example/Lasso.xcworkspace" - #command: fastlane scan --workspace "Example/Lasso.xcworkspace" --code_coverage --output_directory output/scan - environment: - SCAN_DEVICE: iPhone 8 - SCAN_SCHEME: Lasso-Example - - # Build the SwiftPM Example app & run the tests - build_swiftpm: - steps: - - run: - name: Build and run tests - command: >- - xcodebuild build - -project "Example/SwiftPM/Lasso-SwiftPM/Lasso-SwiftPM.xcodeproj" - -scheme "Lasso-SwiftPM" - -destination "platform=iOS Simulator,name=iPhone 11" - -jobs: - - build-gem-cache-26: - <<: *defaults - macos: - xcode: 11.3.0 - steps: - - checkout - - setup_ruby: - version: '2.6' - - build-gem-cache-27: - <<: *defaults - macos: - xcode: 12.0.0 - steps: - - checkout - - setup_ruby: - version: '2.7' - - build-and-test-swift51: - <<: *defaults - macos: - xcode: 11.3.0 - steps: - - checkout - - install_dependencies: - ruby: '2.6' - - pod_update: - swift: '5.1' - - build - - build-and-test-swift52: - <<: *defaults - macos: - xcode: 11.4.0 - steps: - - checkout - - install_dependencies: - ruby: '2.6' - - pod_update: - swift: '5.2' - - build - - build-and-test-swift53: - <<: *defaults - macos: - xcode: 12.0.0 - steps: - - checkout - - install_dependencies: - ruby: '2.7' - - pod_update: - swift: '5.3' - - build - - build-and-test-swift55: - <<: *defaults - macos: - xcode: 13.0.0 - steps: - - checkout - - install_dependencies: - ruby: '2.7' - - pod_update: - swift: '5.5' - - build - - build-and-test-swiftpm: - <<: *defaults - macos: - xcode: 11.4.0 - environment: - FL_OUTPUT_DIR: output - steps: - - checkout - - install_dependencies: - ruby: '2.6' - - build_swiftpm - -workflows: - version: 2 - - build-test: - jobs: - - build-gem-cache-26 - - build-gem-cache-27 - - build-and-test-swift51: - requires: - - build-gem-cache-26 - - build-and-test-swift52: - requires: - - build-gem-cache-26 - - build-and-test-swift53: - requires: - - build-gem-cache-27 - - build-and-test-swift55: - requires: - - build-gem-cache-27 - - build-and-test-swiftpm: - requires: - - build-gem-cache-26