From 35b46910e75e491f066a12b7d18fdadbc45afcf4 Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Thu, 26 Sep 2024 11:25:54 -0400 Subject: [PATCH] Add StagehandTesting to SPM package, update CI (#76) Co-authored-by: Dan Federman --- .github/workflows/ci.yml | 23 ++++++++---------- .gitignore | 2 -- Package.resolved | 14 +++++++++++ Package.swift | 24 ++++++++++++++++--- Scripts/github/prepare-simulators.sh | 11 --------- .../FBSnapshotTestCase+Animation.swift | 3 +-- .../FBSnapshotTestCase+AnimationGIF.swift | 3 +-- WORKSPACE.bzlmod | 1 - 8 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 Package.resolved delete mode 100755 Scripts/github/prepare-simulators.sh delete mode 100644 WORKSPACE.bzlmod diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c5bca7..1940e5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,11 +15,7 @@ jobs: uses: actions/checkout@v4 - name: Bundle Install run: bundle install --gemfile=Example/Gemfile - - name: Pod Install - run: bundle exec --gemfile=Example/Gemfile pod install --project-directory=Example - - name: Lint Stagehand Podspec - run: bundle exec --gemfile=Example/Gemfile pod lib lint --verbose --fail-fast Stagehand.podspec - - name: Lint StagehandTesting Podspec + - name: Lint podspecs run: bundle exec --gemfile=Example/Gemfile pod lib lint --verbose --fail-fast --include-podspecs=Stagehand.podspec StagehandTesting.podspec spm: name: SPM Build @@ -28,14 +24,17 @@ jobs: fail-fast: false steps: - name: Checkout Repo - uses: actions/checkout@v2 - - name: Prepare Simulator Runtimes - run: Scripts/github/prepare-simulators.sh ${{ matrix.platform }} + uses: actions/checkout@v4 - name: Build run: | - swift build \ - --sdk "$(xcode-select -p)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" \ - --triple "arm64-apple-ios13.0" + # select minimum supported Xcode version + sudo xcode-select -s /Applications/Xcode_14.3.1.app + # TODO: add SPM test target, for now just run build on all products. + xcodebuild build \ + -scheme Stagehand-Package \ + -sdk iphonesimulator16.4 \ + -destination "OS=16.4,name=iPhone 13 Pro" + xcode-build: name: Xcode Build runs-on: macOS-14 @@ -46,8 +45,6 @@ jobs: uses: actions/checkout@v4 - name: Bundle Install run: bundle install --gemfile=Example/Gemfile - - name: Prepare Simulator Runtimes - run: Scripts/github/prepare-simulators.sh ${{ matrix.platform }} - name: Pod Install run: bundle exec --gemfile=Example/Gemfile pod install --project-directory=Example - name: Select Xcode Version diff --git a/.gitignore b/.gitignore index e743b1f..377ad6f 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,3 @@ generated/ .build/ .swiftpm/ -# Bazel -bazel-* diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..77089ce --- /dev/null +++ b/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "swift-snapshot-testing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-snapshot-testing.git", + "state" : { + "revision" : "5c3d2141fb0e55da411577012c917962b6b3517e", + "version" : "1.8.0" + } + } + ], + "version" : 2 +} diff --git a/Package.swift b/Package.swift index 6a975f7..3351723 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0.1 +// swift-tools-version:5.8 // // Copyright 2020 Square Inc. @@ -22,18 +22,36 @@ let package = Package( name: "Stagehand", platforms: [ .iOS(.v12), + .macOS(.v11), ], products: [ .library( name: "Stagehand", targets: ["Stagehand"] ), + .library( + name: "StagehandTesting", + targets: ["StagehandTesting"] + ), + ], + dependencies: [ + .package( + url: "https://github.com/pointfreeco/swift-snapshot-testing.git", + .upToNextMajor(from: "1.8.0") + ), ], targets: [ .target( name: "Stagehand", - dependencies: [], - path: "Sources/Stagehand" + dependencies: [] + ), + .target( + name: "StagehandTesting", + dependencies: [ + "Stagehand", + .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), + ], + exclude: ["iOSSnapshotTestCase"] ), ], swiftLanguageVersions: [.v5] diff --git a/Scripts/github/prepare-simulators.sh b/Scripts/github/prepare-simulators.sh deleted file mode 100755 index a5cbe0f..0000000 --- a/Scripts/github/prepare-simulators.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -l -set -ex -IFS=','; PLATFORMS=$(echo $1); unset IFS -sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes - -if [[ ${PLATFORMS[*]} =~ 'iOS_13' ]]; then - sudo ln -s /Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 13.3.simruntime - sudo ln -s /Applications/Xcode_11.7.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 13.7.simruntime -fi - -xcrun simctl list runtimes diff --git a/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+Animation.swift b/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+Animation.swift index 88b55bd..48d7259 100644 --- a/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+Animation.swift +++ b/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+Animation.swift @@ -14,8 +14,7 @@ // limitations under the License. // -#if BAZEL_PACKAGE -@testable import StagehandTestingCore +#if SWIFT_PACKAGE import iOSSnapshotTestCase #else import FBSnapshotTestCase diff --git a/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+AnimationGIF.swift b/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+AnimationGIF.swift index 021ab20..6e78b76 100644 --- a/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+AnimationGIF.swift +++ b/Sources/StagehandTesting/iOSSnapshotTestCase/FBSnapshotTestCase+AnimationGIF.swift @@ -14,8 +14,7 @@ // limitations under the License. // -#if BAZEL_PACKAGE -@testable import StagehandTestingCore +#if SWIFT_PACKAGE import iOSSnapshotTestCase #else import FBSnapshotTestCase diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod deleted file mode 100644 index 1fa1775..0000000 --- a/WORKSPACE.bzlmod +++ /dev/null @@ -1 +0,0 @@ -"""Defines the WORKSPACE when using bzlmod, this should be empty. Use MODULE.bazel instead"""