diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml new file mode 100644 index 0000000..ce9d567 --- /dev/null +++ b/.github/actions/build-ios/action.yml @@ -0,0 +1,24 @@ +name: Build & Test iOS +description: 'Build for iOS device and run tests on iOS Simulator.' +inputs: + ios-sim: + description: 'iOS Simulator to use for testing' + required: true + +runs: + using: composite + steps: + # Workaround for intermittent macos-15 runner issue where simulator + # runtimes aren't loaded. Listing devices forces the simulator service + # to initialize. See https://github.com/actions/runner-images/issues/12948 + - name: Prepare iOS Simulator runtime + shell: bash + run: xcrun simctl list devices available + + - name: Build Tests for iOS device + shell: bash + run: xcodebuild build-for-testing -scheme 'LDSwiftEventSource' -sdk iphoneos CODE_SIGN_IDENTITY= | xcpretty + + - name: Build & Test on iOS Simulator + shell: bash + run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk iphonesimulator -destination '${{ inputs.ios-sim }}' CODE_SIGN_IDENTITY= | xcpretty diff --git a/.github/actions/build-macos/action.yml b/.github/actions/build-macos/action.yml new file mode 100644 index 0000000..01d2737 --- /dev/null +++ b/.github/actions/build-macos/action.yml @@ -0,0 +1,13 @@ +name: Build & Test macOS +description: 'Build and test for macOS.' + +runs: + using: composite + steps: + - name: Build & Test on macOS + shell: bash + run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk macosx -destination 'platform=macOS' | xcpretty + + - name: Build for ARM64 macOS + shell: bash + run: xcodebuild build -scheme 'LDSwiftEventSource' -arch arm64e -sdk macosx | xcpretty diff --git a/.github/actions/build-tvos/action.yml b/.github/actions/build-tvos/action.yml new file mode 100644 index 0000000..7152e1a --- /dev/null +++ b/.github/actions/build-tvos/action.yml @@ -0,0 +1,20 @@ +name: Build & Test tvOS +description: 'Build for tvOS device and run tests on tvOS Simulator.' + +runs: + using: composite + steps: + # Workaround for intermittent macos-15 runner issue where simulator + # runtimes aren't loaded. Listing devices forces the simulator service + # to initialize. See https://github.com/actions/runner-images/issues/12948 + - name: Prepare tvOS Simulator runtime + shell: bash + run: xcrun simctl list devices available + + - name: Build Tests for tvOS device + shell: bash + run: xcodebuild build-for-testing -scheme 'LDSwiftEventSource' -sdk appletvos CODE_SIGN_IDENTITY= | xcpretty + + - name: Build & Test on tvOS Simulator + shell: bash + run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty diff --git a/.github/actions/build-watchos/action.yml b/.github/actions/build-watchos/action.yml new file mode 100644 index 0000000..8e5e673 --- /dev/null +++ b/.github/actions/build-watchos/action.yml @@ -0,0 +1,20 @@ +name: Build watchOS +description: 'Build for watchOS device and simulator.' + +runs: + using: composite + steps: + # Workaround for intermittent macos-15 runner issue where simulator + # runtimes aren't loaded. Listing devices forces the simulator service + # to initialize. See https://github.com/actions/runner-images/issues/12948 + - name: Prepare watchOS Simulator runtime + shell: bash + run: xcrun simctl list devices available + + - name: Build for watchOS simulator + shell: bash + run: xcodebuild build -scheme 'LDSwiftEventSource' -sdk watchsimulator | xcpretty + + - name: Build for watchOS device + shell: bash + run: xcodebuild build -scheme 'LDSwiftEventSource' -sdk watchos | xcpretty diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml deleted file mode 100644 index d17638c..0000000 --- a/.github/actions/ci/action.yml +++ /dev/null @@ -1,78 +0,0 @@ -# This is a composite to allow sharing these steps into other workflows. -# For instance it could be used by regular CI as well as the release process. - -name: CI Workflow -description: 'Shared CI workflow.' -inputs: - xcode-version: - description: 'Which version of xcode should be installed' - required: true - ios-sim: - description: 'iOS Simulator to use for testing' - required: true - token: - description: 'Token to use for publishing.' - required: true - -runs: - using: composite - steps: - - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd - with: - xcode-version: ${{ inputs.xcode-version }} - - - name: Install mint - shell: bash - run: brew install mint - - - name: Bootstrap Mint packages - shell: bash - run: mint bootstrap - - - name: Install cocoapods - shell: bash - run: gem install cocoapods - - - name: Lint the podspec - shell: bash - run: pod spec lint LDSwiftEventSource.podspec - - - name: Build & Test on macOS Simulator - shell: bash - run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk macosx -destination 'platform=macOS' | xcpretty - - - name: Build for ARM64 macOS - shell: bash - run: xcodebuild build -scheme 'LDSwiftEventSource' -arch arm64e -sdk macosx | xcpretty - - - name: Build Tests for iOS device - shell: bash - run: xcodebuild build-for-testing -scheme 'LDSwiftEventSource' -sdk iphoneos CODE_SIGN_IDENTITY= | xcpretty - - - name: Build & Test on iOS Simulator - shell: bash - run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk iphonesimulator -destination '${{ inputs.ios-sim }}' CODE_SIGN_IDENTITY= | xcpretty - - - name: Build Tests for tvOS device - shell: bash - run: xcodebuild build-for-testing -scheme 'LDSwiftEventSource' -sdk appletvos CODE_SIGN_IDENTITY= | xcpretty - - - name: Build & Test on tvOS Simulator - shell: bash - run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty - - - name: Build for watchOS simulator # No XCTest testing on watchOS - shell: bash - run: xcodebuild build -scheme 'LDSwiftEventSource' -sdk watchsimulator | xcpretty - - - name: Build for watchOS device # No XCTest testing on watchOS - shell: bash - run: xcodebuild build -scheme 'LDSwiftEventSource' -sdk watchos | xcpretty - - - name: Build & Test with swiftpm - shell: bash - run: swift test -v 2>&1 | xcpretty - - - name: Run contract tests - shell: bash - run: make contract-tests diff --git a/.github/actions/contract-tests/action.yml b/.github/actions/contract-tests/action.yml new file mode 100644 index 0000000..3272f2f --- /dev/null +++ b/.github/actions/contract-tests/action.yml @@ -0,0 +1,29 @@ +name: Contract Tests +description: 'Build and run SDK contract tests.' +inputs: + token: + description: 'GH token used to download SDK test harness.' + required: true + +runs: + using: composite + steps: + - name: Build contract test service + shell: bash + run: make build-contract-tests + + - name: Start contract test service + shell: bash + run: make start-contract-test-service-bg + + - name: Run contract tests + uses: launchdarkly/gh-actions/actions/contract-tests@main + with: + repo: sse-contract-tests + branch: main + version: v2 + token: ${{ inputs.token }} + test_service_port: '8000' + debug_logging: 'true' + enable_persistence_tests: 'false' + extra_params: "-skip 'basic parsing/large message in one chunk' -skip 'basic parsing/large message in two chunks'" diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml new file mode 100644 index 0000000..2913fc8 --- /dev/null +++ b/.github/actions/lint/action.yml @@ -0,0 +1,22 @@ +name: Lint +description: 'Run podspec and swiftlint checks.' + +runs: + using: composite + steps: + - name: Install swiftlint + shell: bash + run: brew install swiftlint + + - name: Install cocoapods + shell: bash + run: gem install cocoapods + + - name: Lint the podspec + shell: bash + # --quick skips building since dedicated build jobs already compile all platforms + run: pod lib lint LDSwiftEventSource.podspec --allow-warnings --quick + + - name: Run swiftlint + shell: bash + run: swiftlint lint diff --git a/.github/actions/test-swiftpm/action.yml b/.github/actions/test-swiftpm/action.yml new file mode 100644 index 0000000..1501547 --- /dev/null +++ b/.github/actions/test-swiftpm/action.yml @@ -0,0 +1,9 @@ +name: Test SwiftPM +description: 'Build and test using Swift Package Manager.' + +runs: + using: composite + steps: + - name: Build & Test with SwiftPM + shell: bash + run: swift test -v 2>&1 | xcpretty diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e30afc5..b48db8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,26 +10,104 @@ on: - '**.md' jobs: - macos-build: - runs-on: ${{ matrix.os }} + lint: + runs-on: macos-15 - strategy: - fail-fast: false - matrix: - include: - - xcode-version: 16.4 - ios-sim: 'platform=iOS Simulator,name=iPhone 16' - os: macos-15 + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/lint + + build-ios: + runs-on: macos-15 steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/ci + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/build-ios + with: + ios-sim: 'platform=iOS Simulator,name=iPhone 16' + + build-macos: + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/build-macos + + build-tvos: + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/build-tvos + + build-watchos: + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/build-watchos + + test-swiftpm: + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/test-swiftpm + + contract-tests: + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + + - uses: ./.github/actions/contract-tests with: - xcode-version: ${{ matrix.xcode-version }} - ios-sim: ${{ matrix.ios-sim }} token: ${{ secrets.GITHUB_TOKEN }} + build-docs: + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: 16.4 + - uses: ./.github/actions/build-docs linux-build: diff --git a/.github/workflows/manual-publish-docs.yml b/.github/workflows/manual-publish-docs.yml index 1a43ce4..9f2b787 100644 --- a/.github/workflows/manual-publish-docs.yml +++ b/.github/workflows/manual-publish-docs.yml @@ -13,11 +13,26 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Build and Test - uses: ./.github/actions/ci + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: 16.4 + + - uses: ./.github/actions/lint + + - uses: ./.github/actions/build-ios + with: ios-sim: 'platform=iOS Simulator,name=iPhone 16' + + - uses: ./.github/actions/build-macos + + - uses: ./.github/actions/build-tvos + + - uses: ./.github/actions/build-watchos + + - uses: ./.github/actions/test-swiftpm + + - uses: ./.github/actions/contract-tests + with: token: ${{ secrets.GITHUB_TOKEN }} - uses: ./.github/actions/build-docs diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index c660025..51f931c 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -25,10 +25,26 @@ jobs: aws_assume_role: ${{ vars.AWS_ROLE_ARN }} ssm_parameter_pairs: '/production/common/releasing/cocoapods/token = COCOAPODS_TRUNK_TOKEN' - - uses: ./.github/actions/ci + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: 16.4 + + - uses: ./.github/actions/lint + + - uses: ./.github/actions/build-ios + with: ios-sim: 'platform=iOS Simulator,name=iPhone 16' + + - uses: ./.github/actions/build-macos + + - uses: ./.github/actions/build-tvos + + - uses: ./.github/actions/build-watchos + + - uses: ./.github/actions/test-swiftpm + + - uses: ./.github/actions/contract-tests + with: token: ${{ secrets.GITHUB_TOKEN }} - uses: ./.github/actions/publish diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 6acdcb0..ed5069d 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -42,11 +42,34 @@ jobs: aws_assume_role: ${{ vars.AWS_ROLE_ARN }} ssm_parameter_pairs: '/production/common/releasing/cocoapods/token = COCOAPODS_TRUNK_TOKEN' - - uses: ./.github/actions/ci + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd if: ${{ steps.release.outputs.releases_created == 'true' }} with: xcode-version: 16.4 + + - uses: ./.github/actions/lint + if: ${{ steps.release.outputs.releases_created == 'true' }} + + - uses: ./.github/actions/build-ios + if: ${{ steps.release.outputs.releases_created == 'true' }} + with: ios-sim: 'platform=iOS Simulator,name=iPhone 16' + + - uses: ./.github/actions/build-macos + if: ${{ steps.release.outputs.releases_created == 'true' }} + + - uses: ./.github/actions/build-tvos + if: ${{ steps.release.outputs.releases_created == 'true' }} + + - uses: ./.github/actions/build-watchos + if: ${{ steps.release.outputs.releases_created == 'true' }} + + - uses: ./.github/actions/test-swiftpm + if: ${{ steps.release.outputs.releases_created == 'true' }} + + - uses: ./.github/actions/contract-tests + if: ${{ steps.release.outputs.releases_created == 'true' }} + with: token: ${{ secrets.GITHUB_TOKEN }} - uses: ./.github/actions/build-docs diff --git a/Mintfile b/Mintfile deleted file mode 100644 index 556adef..0000000 --- a/Mintfile +++ /dev/null @@ -1 +0,0 @@ -realm/SwiftLint@0.56.2