From 6ae3942565a9c2f4eb83319b3698f9bcf169b006 Mon Sep 17 00:00:00 2001 From: Miron Pawlik Date: Mon, 27 May 2024 14:54:45 +0200 Subject: [PATCH 1/3] Move to scripts --- .github/workflows/ci.yaml | 2 +- compile_proto.sh => scripts/compile_proto.sh | 0 gen-mocks.sh => scripts/gen-mocks.sh | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename compile_proto.sh => scripts/compile_proto.sh (100%) rename gen-mocks.sh => scripts/gen-mocks.sh (91%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3c6e825..26c0861 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,7 @@ jobs: run: swift-format lint -r -s ./**/**/*.swift --configuration swift-format-config.json - name: Generate mocks 🫥 - run: swift package update Mockingbird && ./gen-mocks.sh + run: swift package update Mockingbird && ./scripts/gen-mocks.sh - name: Run tests 💀 run: set -o pipefail && xcodebuild -scheme FishjamClientTests test -destination "platform=iOS Simulator,name=iPhone 14,OS=latest" | xcbeautify 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 \ From ae950ae769bae4b38b8bf637220b34db692b1d4a Mon Sep 17 00:00:00 2001 From: Miron Pawlik Date: Mon, 27 May 2024 14:56:12 +0200 Subject: [PATCH 2/3] Update init script --- .gitignore | 1 + project.json | 223 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/init.sh | 3 +- 3 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 project.json 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/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/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 From 93ad28a0deb74193f95dcd56431dea75287c2652 Mon Sep 17 00:00:00 2001 From: Miron Pawlik Date: Mon, 27 May 2024 14:56:17 +0200 Subject: [PATCH 3/3] add commands --- .github/workflows/ci.yaml | 8 ++++---- package.json | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 26c0861..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 && ./scripts/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/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