From fb774278f35c694379949b2e3dae9c3fe5c4bfaf Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Wed, 14 May 2025 11:52:11 -0400 Subject: [PATCH 1/7] feat: Adding Cocoapods support Signed-off-by: Jonathan Norris --- .github/workflows/release-please.yaml | 17 +++++++++++++++++ CONTRIBUTING.md | 8 ++++++-- scripts/update_podspec.sh | 12 ++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 scripts/update_podspec.sh diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index b448c31..768fa09 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -24,6 +24,23 @@ jobs: run: | echo "$RELEASE_PLEASE_OUTPUT" + # Update podspec version when a release PR is created or updated + - name: Checkout code if PR is generated/updated + if: ${{ steps.release.outputs.pr }} + uses: actions/checkout@v3 + with: + ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} + + - name: Update podspec version + if: ${{ steps.release.outputs.pr }} + run: | + ./scripts/update_podspec.sh + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add OpenFeature.podspec + git commit -m "chore: update podspec version [skip ci]" || true + git push + # Outputs are namespaced by package when using a manifest in Release Please outputs: release_created: ${{ steps.release.outputs['OpenFeature--release_created'] }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d27784b..5d42f2d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,11 +30,15 @@ swift test The project includes CocoaPods support via the `OpenFeature.podspec` file. When making changes: 1. The version in the podspec is automatically updated from `version.txt` during the release process -2. To validate the podspec locally, run: +2. You can manually update the podspec version by running: + ```shell + ./scripts/update_podspec.sh + ``` +3. To validate the podspec locally, run: ```shell pod spec lint OpenFeature.podspec --allow-warnings ``` -3. The CocoaPods validation and publishing is handled automatically via GitHub workflows on release +4. The CocoaPods validation and publishing is handled automatically via GitHub workflows on release #### Token Management diff --git a/scripts/update_podspec.sh b/scripts/update_podspec.sh new file mode 100755 index 0000000..7c373b8 --- /dev/null +++ b/scripts/update_podspec.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Exit if any command fails +set -e + +# Get the version from version.txt +VERSION=$(cat version.txt | tr -d '\n') + +# Update the version in the podspec +sed -i '' "s/s.version.*=.*/s.version = '$VERSION'/g" OpenFeature.podspec + +echo "Updated OpenFeature.podspec to version $VERSION" \ No newline at end of file From 0f494fec41ffa97f12665297d6a0768b49ef2535 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Fri, 23 May 2025 12:07:18 -0400 Subject: [PATCH 2/7] docs: update contrib docs Signed-off-by: Jonathan Norris --- CONTRIBUTING.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d42f2d..eaa3cd2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,11 +30,7 @@ swift test The project includes CocoaPods support via the `OpenFeature.podspec` file. When making changes: 1. The version in the podspec is automatically updated from `version.txt` during the release process -2. You can manually update the podspec version by running: - ```shell - ./scripts/update_podspec.sh - ``` -3. To validate the podspec locally, run: +2. To validate the podspec locally, run: ```shell pod spec lint OpenFeature.podspec --allow-warnings ``` From 2dffe8be6635b66cd08a2bb647900791dc93431e Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Fri, 23 May 2025 16:20:07 -0400 Subject: [PATCH 3/7] feat: add watchOS and tvOS support to iOS SDK Signed-off-by: Jonathan Norris --- .github/workflows/ci.yaml | 40 +++++++++++++++++++++++-------- OpenFeature.podspec | 4 +++- Package.swift | 7 +++--- README.md | 10 +++++--- scripts/validate-platforms.sh | 45 +++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 17 deletions(-) create mode 100755 scripts/validate-platforms.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 158e23e..9fb08e5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,24 +3,44 @@ name: CI on: pull_request: branches: - - 'main' + - "main" push: branches: - - 'main' + - "main" jobs: Tests: runs-on: macOS-latest + strategy: + matrix: + platform: [iOS, macOS, watchOS, tvOS] + include: + - platform: iOS + destination: "platform=iOS Simulator,name=iPhone 15" + - platform: macOS + destination: "platform=macOS" + - platform: watchOS + destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)" + - platform: tvOS + destination: "platform=tvOS Simulator,name=Apple TV" steps: - - uses: actions/checkout@v4 - - name: Build and Test - run: swift test + - uses: actions/checkout@v4 + - name: Build and Test on ${{ matrix.platform }} + run: | + if [ "${{ matrix.platform }}" = "macOS" ]; then + swift test + else + xcodebuild test \ + -workspace .swiftpm/xcode/package.xcworkspace \ + -scheme OpenFeature \ + -destination "${{ matrix.destination }}" + fi SwiftLint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: GitHub Action for SwiftLint - uses: norio-nomura/action-swiftlint@3.2.1 - with: - args: --config .swiftlint.yml + - uses: actions/checkout@v4 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + with: + args: --config .swiftlint.yml diff --git a/OpenFeature.podspec b/OpenFeature.podspec index 4013744..21211a0 100644 --- a/OpenFeature.podspec +++ b/OpenFeature.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.version = '0.3.0' # x-release-please-version s.summary = 'OpenFeature iOS SDK' s.description = <<-DESC -OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution. +OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution. This Swift SDK supports iOS, macOS, watchOS, and tvOS. DESC s.homepage = 'https://github.com/open-feature/swift-sdk' s.license = { :type => 'Apache-2.0', :file => 'LICENSE' } @@ -12,6 +12,8 @@ OpenFeature is an open specification that provides a vendor-agnostic, community- s.ios.deployment_target = '14.0' s.osx.deployment_target = '11.0' + s.watchos.deployment_target = '7.0' + s.tvos.deployment_target = '14.0' s.swift_version = '5.5' s.source_files = 'Sources/OpenFeature/**/*' diff --git a/Package.swift b/Package.swift index b222577..9d038e0 100644 --- a/Package.swift +++ b/Package.swift @@ -8,14 +8,15 @@ let package = Package( platforms: [ .iOS(.v14), .macOS(.v11), + .watchOS(.v7), + .tvOS(.v14), ], products: [ .library( name: "OpenFeature", - targets: ["OpenFeature"]), - ], - dependencies: [ + targets: ["OpenFeature"]) ], + dependencies: [], targets: [ .target( name: "OpenFeature", diff --git a/README.md b/README.md index 8a5410f..4ec6ccc 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,13 @@ ### Requirements -- The minimum iOS version supported is: `iOS 14`. +This SDK supports the following Apple platforms: +- **iOS 14+** +- **macOS 11+** +- **watchOS 7+** +- **tvOS 14+** -Note that this library is intended to be used in a mobile context, and has not been evaluated for use in other type of applications (e.g. server applications, macOS, tvOS, watchOS, etc.). +The SDK is built with Swift 5.5+ and uses only Foundation and Combine frameworks, making it suitable for all Apple platform contexts including mobile, desktop, wearable, and TV applications. ### Install @@ -85,7 +89,7 @@ Then, run: pod install ``` -### Usage +### iOS Usage ```swift import OpenFeature diff --git a/scripts/validate-platforms.sh b/scripts/validate-platforms.sh new file mode 100755 index 0000000..b9421b9 --- /dev/null +++ b/scripts/validate-platforms.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Script to validate that OpenFeature builds and runs on all Apple platforms + +set -e + +echo "๐Ÿš€ Validating OpenFeature Swift SDK on all Apple platforms..." +echo "" + +# Function to run platform tests +test_platform() { + local platform=$1 + local destination=$2 + + echo "๐Ÿงช Testing $platform..." + + if [ "$platform" = "macOS" ]; then + swift test + echo "โœ… $platform tests passed" + else + xcodebuild test -workspace .swiftpm/xcode/package.xcworkspace -scheme OpenFeature -destination "$destination" + echo "โœ… $platform tests passed" + fi +} + +# Test all platforms using specific working devices +test_platform "macOS" "platform=macOS" +echo "" + +test_platform "iOS" "platform=iOS Simulator,name=iPhone 16" +echo "" + +test_platform "watchOS" "platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)" +echo "" + +test_platform "tvOS" "platform=tvOS Simulator,name=Apple TV" +echo "" + +# Summary +echo "๐Ÿ“‹ Platform configuration:" +grep -A 10 "platforms:" Package.swift | head -6 + +echo "" +echo "๐ŸŽ‰ OpenFeature Swift SDK platform validation completed!" +echo "" \ No newline at end of file From ff89581055817a2cbdb28b85182469c294ed1e15 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Mon, 9 Jun 2025 16:50:33 -0400 Subject: [PATCH 4/7] chore: cleanup contrib.md changes Signed-off-by: Jonathan Norris --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eaa3cd2..d27784b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,7 @@ The project includes CocoaPods support via the `OpenFeature.podspec` file. When ```shell pod spec lint OpenFeature.podspec --allow-warnings ``` -4. The CocoaPods validation and publishing is handled automatically via GitHub workflows on release +3. The CocoaPods validation and publishing is handled automatically via GitHub workflows on release #### Token Management From 697ccc07665d020c6b8a1dc0e90410a59d961949 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Mon, 9 Jun 2025 16:51:45 -0400 Subject: [PATCH 5/7] chore: cleanup podspec changes Signed-off-by: Jonathan Norris --- .github/workflows/release-please.yaml | 17 ----------------- scripts/update_podspec.sh | 12 ------------ 2 files changed, 29 deletions(-) delete mode 100755 scripts/update_podspec.sh diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 768fa09..b448c31 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -24,23 +24,6 @@ jobs: run: | echo "$RELEASE_PLEASE_OUTPUT" - # Update podspec version when a release PR is created or updated - - name: Checkout code if PR is generated/updated - if: ${{ steps.release.outputs.pr }} - uses: actions/checkout@v3 - with: - ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} - - - name: Update podspec version - if: ${{ steps.release.outputs.pr }} - run: | - ./scripts/update_podspec.sh - git config --global user.name "github-actions[bot]" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add OpenFeature.podspec - git commit -m "chore: update podspec version [skip ci]" || true - git push - # Outputs are namespaced by package when using a manifest in Release Please outputs: release_created: ${{ steps.release.outputs['OpenFeature--release_created'] }} diff --git a/scripts/update_podspec.sh b/scripts/update_podspec.sh deleted file mode 100755 index 7c373b8..0000000 --- a/scripts/update_podspec.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Exit if any command fails -set -e - -# Get the version from version.txt -VERSION=$(cat version.txt | tr -d '\n') - -# Update the version in the podspec -sed -i '' "s/s.version.*=.*/s.version = '$VERSION'/g" OpenFeature.podspec - -echo "Updated OpenFeature.podspec to version $VERSION" \ No newline at end of file From 1a8df83197399ff48c0e46e6a545b250c815ba7e Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Mon, 9 Jun 2025 16:53:35 -0400 Subject: [PATCH 6/7] chore: remove validate-platforms.sh script Signed-off-by: Jonathan Norris --- scripts/validate-platforms.sh | 45 ----------------------------------- 1 file changed, 45 deletions(-) delete mode 100755 scripts/validate-platforms.sh diff --git a/scripts/validate-platforms.sh b/scripts/validate-platforms.sh deleted file mode 100755 index b9421b9..0000000 --- a/scripts/validate-platforms.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Script to validate that OpenFeature builds and runs on all Apple platforms - -set -e - -echo "๐Ÿš€ Validating OpenFeature Swift SDK on all Apple platforms..." -echo "" - -# Function to run platform tests -test_platform() { - local platform=$1 - local destination=$2 - - echo "๐Ÿงช Testing $platform..." - - if [ "$platform" = "macOS" ]; then - swift test - echo "โœ… $platform tests passed" - else - xcodebuild test -workspace .swiftpm/xcode/package.xcworkspace -scheme OpenFeature -destination "$destination" - echo "โœ… $platform tests passed" - fi -} - -# Test all platforms using specific working devices -test_platform "macOS" "platform=macOS" -echo "" - -test_platform "iOS" "platform=iOS Simulator,name=iPhone 16" -echo "" - -test_platform "watchOS" "platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)" -echo "" - -test_platform "tvOS" "platform=tvOS Simulator,name=Apple TV" -echo "" - -# Summary -echo "๐Ÿ“‹ Platform configuration:" -grep -A 10 "platforms:" Package.swift | head -6 - -echo "" -echo "๐ŸŽ‰ OpenFeature Swift SDK platform validation completed!" -echo "" \ No newline at end of file From 20da1bde7784e4b87cf38abd150f3580746b13a3 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Wed, 11 Jun 2025 10:43:17 -0400 Subject: [PATCH 7/7] fix: trying to get platform tests to run Signed-off-by: Jonathan Norris --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9fb08e5..dfeb126 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: - platform: watchOS destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)" - platform: tvOS - destination: "platform=tvOS Simulator,name=Apple TV" + destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation)" steps: - uses: actions/checkout@v4 - name: Build and Test on ${{ matrix.platform }} @@ -31,7 +31,6 @@ jobs: swift test else xcodebuild test \ - -workspace .swiftpm/xcode/package.xcworkspace \ -scheme OpenFeature \ -destination "${{ matrix.destination }}" fi