diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3c6e825..db941ef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,13 +11,13 @@ jobs: run: brew install swift-format xcbeautify - name: Run formatter 🎨 - run: swift-format format -i -r ./**/**/*.swift --configuration swift-format-config.json + run: yarn format - name: Run lint 👀 - run: swift-format lint -r -s ./**/**/*.swift --configuration swift-format-config.json + run: yarn lint - name: Generate mocks 🫥 - run: swift package update Mockingbird && ./gen-mocks.sh + run: yarn mocks - name: Run tests 💀 - run: set -o pipefail && xcodebuild -scheme FishjamClientTests test -destination "platform=iOS Simulator,name=iPhone 14,OS=latest" | xcbeautify + run: yarn test diff --git a/.gitignore b/.gitignore index ba9133e..ac8c9c6 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,7 @@ iOSInjectionProject/ node_modules +yarn-error.log FishjamClientDemo/Debug.xcconfig diff --git a/package.json b/package.json index 70bf1e1..4e3a20e 100644 --- a/package.json +++ b/package.json @@ -2,5 +2,12 @@ "devDependencies": { "@release-it/bumper": "^4.0.0", "release-it": "^15.5.0" + }, + "scripts": { + "prepare": "./scripts/init.sh", + "lint": "swift-format lint -r -s ./**/**/*.swift --configuration swift-format-config.json", + "format": "swift-format format -r -i ./**/**/*.swift --configuration swift-format-config.json", + "test": "set -o pipefail && xcodebuild -scheme FishjamClientTests test -destination \"platform=iOS Simulator,name=iPhone 14,OS=latest\" | xcbeautify", + "mocks": "swift package update Mockingbird && ./scripts/gen-mocks.sh" } -} +} \ No newline at end of file diff --git a/project.json b/project.json new file mode 100644 index 0000000..d003c61 --- /dev/null +++ b/project.json @@ -0,0 +1,223 @@ +{ + "dependencies" : [ + { + "identity" : "specs", + "requirement" : { + "exact" : [ + "114.5735.8" + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/webrtc-sdk/Specs.git" + }, + { + "identity" : "swift-protobuf", + "requirement" : { + "range" : [ + { + "lower_bound" : "1.18.0", + "upper_bound" : "2.0.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/apple/swift-protobuf.git" + }, + { + "identity" : "starscream", + "requirement" : { + "range" : [ + { + "lower_bound" : "4.0.0", + "upper_bound" : "5.0.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/daltoniam/Starscream.git" + }, + { + "identity" : "mockingbird", + "requirement" : { + "range" : [ + { + "lower_bound" : "0.20.0", + "upper_bound" : "0.21.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/birdrides/mockingbird.git" + }, + { + "identity" : "promises", + "requirement" : { + "range" : [ + { + "lower_bound" : "2.0.0", + "upper_bound" : "3.0.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/google/promises.git" + }, + { + "identity" : "swiftphoenixclient", + "requirement" : { + "range" : [ + { + "lower_bound" : "5.0.0", + "upper_bound" : "6.0.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/davidstump/SwiftPhoenixClient.git" + }, + { + "identity" : "swift-log", + "requirement" : { + "range" : [ + { + "lower_bound" : "1.4.2", + "upper_bound" : "2.0.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/apple/swift-log.git" + }, + { + "identity" : "swift-docc-plugin", + "requirement" : { + "range" : [ + { + "lower_bound" : "1.0.0", + "upper_bound" : "2.0.0" + } + ] + }, + "type" : "sourceControl", + "url" : "https://github.com/apple/swift-docc-plugin" + } + ], + "manifest_display_name" : "FishjamClient", + "name" : "FishjamClient", + "path" : "/Users/mpawlik/Projects/jellyfish/ios-client-sdk", + "platforms" : [ + { + "name" : "ios", + "version" : "13.0" + } + ], + "products" : [ + { + "name" : "FishjamClient", + "targets" : [ + "FishjamClient" + ], + "type" : { + "library" : [ + "automatic" + ] + } + } + ], + "targets" : [ + { + "c99name" : "FishjamClientTests", + "module_type" : "SwiftTarget", + "name" : "FishjamClientTests", + "path" : "Tests/FishjamClientTests", + "product_dependencies" : [ + "Mockingbird" + ], + "sources" : [ + "FishjamClientMocks/JellyfishClientSdkMocks.generated.swift", + "FishjamClientTests.swift", + "PeerConnectionManagerTest.swift" + ], + "target_dependencies" : [ + "FishjamClient" + ], + "type" : "test" + }, + { + "c99name" : "FishjamClient", + "module_type" : "SwiftTarget", + "name" : "FishjamClient", + "path" : "Sources", + "product_dependencies" : [ + "WebRTC", + "SwiftProtobuf", + "Promises", + "SwiftPhoenixClient", + "Starscream", + "FBLPromises", + "Logging" + ], + "product_memberships" : [ + "FishjamClient" + ], + "sources" : [ + "FishjamClient/FishjamClient.swift", + "FishjamClient/FishjamClientInternal.swift", + "FishjamClient/FishjamClientListener.swift", + "FishjamClient/TestUtils.swift", + "FishjamClient/protos/fishjam/peer_notifications.pb.swift", + "MembraneRTC/Constants.swift", + "MembraneRTC/EventTransport/EventTransport.swift", + "MembraneRTC/EventTransport/PhoenixTransport.swift", + "MembraneRTC/Events/Event.swift", + "MembraneRTC/IPC/IPC.swift", + "MembraneRTC/IPC/broadcast_ipc.pb.swift", + "MembraneRTC/Media/BroadcastSampleSource.swift", + "MembraneRTC/Media/Capturers/CameraCapturer.swift", + "MembraneRTC/Media/Capturers/FileCapturer.swift", + "MembraneRTC/Media/Capturers/ScreenBroadcastCapturer.swift", + "MembraneRTC/Media/Capturers/ScreenCapturer.swift", + "MembraneRTC/Media/Capturers/VideoCapturer.swift", + "MembraneRTC/Media/Dimensions.swift", + "MembraneRTC/Media/ScreenBroadcastNotificationReceiver.swift", + "MembraneRTC/Media/SoundDetection.swift", + "MembraneRTC/Media/Tracks/AudioTrack.swift", + "MembraneRTC/Media/Tracks/LocalAudioTrack.swift", + "MembraneRTC/Media/Tracks/LocalScreenBroadcastTrack.swift", + "MembraneRTC/Media/Tracks/LocalTrack.swift", + "MembraneRTC/Media/Tracks/LocalVideoTrack.swift", + "MembraneRTC/Media/Tracks/MediaTrackProvider.swift", + "MembraneRTC/Media/Tracks/RemoteAudioTrack.swift", + "MembraneRTC/Media/Tracks/RemoteTrack.swift", + "MembraneRTC/Media/Tracks/RemoteVideoTrack.swift", + "MembraneRTC/Media/Tracks/VideoTrack.swift", + "MembraneRTC/Media/VideoParameters.swift", + "MembraneRTC/MembraneRTC.swift", + "MembraneRTC/MembraneRTCDelegate.swift", + "MembraneRTC/PeerConnectionFactoryWrapper.swift", + "MembraneRTC/PeerConnectionListener.swift", + "MembraneRTC/PeerConnectionManager.swift", + "MembraneRTC/RTCEngineCommunication.swift", + "MembraneRTC/RTCEngineListener.swift", + "MembraneRTC/Types/AnyJson.swift", + "MembraneRTC/Types/Encoder.swift", + "MembraneRTC/Types/EncodingReason.swift", + "MembraneRTC/Types/Endpoint.swift", + "MembraneRTC/Types/Metadata.swift", + "MembraneRTC/Types/RTCStats.swift", + "MembraneRTC/Types/SerializedMediaEvent.swift", + "MembraneRTC/Types/SimulcastConfig.swift", + "MembraneRTC/Types/TrackBandwidthLimit.swift", + "MembraneRTC/Types/TrackContext.swift", + "MembraneRTC/Types/TrackData.swift", + "MembraneRTC/Types/VadStatus.swift", + "MembraneRTC/UI/SwiftUIVideoView.swift", + "MembraneRTC/UI/VideoView.swift", + "MembraneRTC/Utilities/MulticastDelegate.swift", + "MembraneRTC/Utilities/SimulcastUtils.swift" + ], + "type" : "library" + } + ], + "tools_version" : "5.5" +} diff --git a/compile_proto.sh b/scripts/compile_proto.sh similarity index 100% rename from compile_proto.sh rename to scripts/compile_proto.sh diff --git a/gen-mocks.sh b/scripts/gen-mocks.sh similarity index 91% rename from gen-mocks.sh rename to scripts/gen-mocks.sh index c999b9d..0b20a1b 100755 --- a/gen-mocks.sh +++ b/scripts/gen-mocks.sh @@ -1,6 +1,6 @@ #!/bin/bash set -eu -cd "$(dirname "$0")" +cd "$(dirname "$0")/.." swift package describe --type json > project.json .build/checkouts/mockingbird/mockingbird generate --project project.json \ --output-dir Tests/FishjamClientTests/FishjamClientMocks \ diff --git a/scripts/init.sh b/scripts/init.sh index b4bc521..84fb17e 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,6 +1,5 @@ #!/bin/bash -brew install swift-format -yarn +brew install swift-format xcbeautify chmod +x .githooks/* cp .githooks/* .git/hooks cp FishjamClientDemo/Release.xcconfig FishjamClientDemo/Debug.xcconfig \ No newline at end of file