diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml new file mode 100644 index 0000000..01c43f9 --- /dev/null +++ b/.github/workflows/build-all.yml @@ -0,0 +1,30 @@ +name: Build and test all + +on: + push: + branches: + - main + paths-ignore: + - "**/*.md" + pull_request: + paths-ignore: + - "**/*.md" + + workflow_dispatch: + +jobs: + lint: + name: Lint + uses: ./.github/workflows/lint.yml + + build-linux: + name: Build Linux + uses: ./.github/workflows/build-linux.yml + + build-macos: + name: Build macOS + uses: ./.github/workflows/build-macos.yml + + build-sample-app-macos: + name: Build Sample App macOS + uses: ./.github/workflows/build-sample-app-macos.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/build-linux.yml similarity index 58% rename from .github/workflows/pull_request.yml rename to .github/workflows/build-linux.yml index 1e4bb97..ed5c9f5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/build-linux.yml @@ -1,11 +1,12 @@ -name: Pull Request Checks +name: Build Linux on: - pull_request: - branches: [ main ] + workflow_call: + workflow_dispatch: jobs: - lint: + build: + name: Build and test Android/JS/WasmJS runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -19,22 +20,13 @@ jobs: - name: Gradle cache uses: gradle/gradle-build-action@v2 - - name: Run Kotlin linter - run: ./gradlew ktlintCheck - - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v1 + - name: Cache konan directory + uses: actions/cache@v3 with: - java-version: 17 - cache: gradle - - - name: Gradle cache - uses: gradle/gradle-build-action@v2 + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('*.gradle.kts', 'buildSrc/*') }} + restore-keys: | + ${{ runner.os }}-konan- - name: Enable KVM run: | @@ -78,37 +70,5 @@ jobs: name: "JS Tests Report HTML" path: "webrtc-kmp/build/reports/tests/wasmJs*Test" - test-ios: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - - name: Cocoapods cache - uses: actions/cache@v3 - id: cocoapods-cache - with: - path: | - ~/.cocoapods - ~/Library/Caches/CocoaPods - */build/cocoapods - */build/classes - key: cocoapods-cache - - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - cache: gradle - - - name: Gradle cache - uses: gradle/gradle-build-action@v2 - - - name: Run iOS tests - run: ./gradlew cleanTest webrtc-kmp:iosSimulatorArm64Test - - - name: Upload iOS test artifact - uses: actions/upload-artifact@v2 - if: failure() - with: - name: "iOS Tests Report HTML" - path: "webrtc-kmp/build/reports/tests/iosX64Test" + - name: Build sample app + run: ./gradlew sample:composeApp:assemble diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 0000000..d6ea142 --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,50 @@ +name: Build macOS + +on: + workflow_call: + workflow_dispatch: + +jobs: + build: + name: Build and test iOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + cache: gradle + + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + + - name: Cache konan directory + uses: actions/cache@v3 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('*.gradle.kts', 'buildSrc/*') }} + restore-keys: | + ${{ runner.os }}-konan- + + - name: Cocoapods cache + uses: actions/cache@v3 + id: cocoapods-cache + with: + path: | + ~/.cocoapods + ~/Library/Caches/CocoaPods + */build/cocoapods + */build/classes + key: cocoapods-cache + + - name: Run iOS tests + run: ./gradlew cleanTest webrtc-kmp:iosSimulatorArm64Test + + - name: Upload iOS test artifact + uses: actions/upload-artifact@v2 + if: failure() + with: + name: "iOS Tests Report HTML" + path: "webrtc-kmp/build/reports/tests/iosX64Test" diff --git a/.github/workflows/build-sample-app-macos.yml b/.github/workflows/build-sample-app-macos.yml new file mode 100644 index 0000000..cd333ef --- /dev/null +++ b/.github/workflows/build-sample-app-macos.yml @@ -0,0 +1,45 @@ +name: Build macOS + +on: + workflow_call: + workflow_dispatch: + +jobs: + build: + name: Build sample app iOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + cache: gradle + + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + + - name: Cache konan directory + uses: actions/cache@v3 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('*.gradle.kts', 'buildSrc/*') }} + restore-keys: | + ${{ runner.os }}-konan- + + - name: Cocoapods cache + uses: actions/cache@v3 + id: cocoapods-cache + with: + path: | + ~/.cocoapods + ~/Library/Caches/CocoaPods + */build/cocoapods + */build/classes + key: cocoapods-cache + + - name: Build sample app + run: | + cd sample/iosApp + xcodebuild -configuration Debug -scheme iosApp -sdk iphonesimulator -arch arm64 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..1b75d72 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,31 @@ +name: Pull Request Checks + +on: + workflow_call: + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + cache: gradle + + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + + - name: Cache konan directory + uses: actions/cache@v3 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('*.gradle.kts', 'buildSrc/*') }} + restore-keys: | + ${{ runner.os }}-konan- + + - name: Run Kotlin linter + run: ./gradlew ktlintCheck diff --git a/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStream.kt b/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStream.kt index 83923ed..c3bb6bb 100644 --- a/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStream.kt +++ b/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStream.kt @@ -1,5 +1,7 @@ package com.shepeliev.webrtckmp.externals +import kotlin.js.JsName + @JsName("MediaStream") external interface PlatformMediaStream { val id: String diff --git a/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStreamTrack.kt b/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStreamTrack.kt index 5b3fc72..3174d6f 100644 --- a/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStreamTrack.kt +++ b/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/externals/PlatformMediaStreamTrack.kt @@ -1,5 +1,6 @@ package com.shepeliev.webrtckmp.externals +import kotlin.js.JsName import com.shepeliev.webrtckmp.FacingMode import com.shepeliev.webrtckmp.MediaStreamTrackState import com.shepeliev.webrtckmp.MediaTrackConstraints diff --git a/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/internal/Console.kt b/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/internal/Console.kt index c0d8a61..55242d9 100644 --- a/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/internal/Console.kt +++ b/webrtc-kmp/src/jsAndWasmJsMain/kotlin/com/shepeliev/webrtckmp/internal/Console.kt @@ -1,5 +1,7 @@ package com.shepeliev.webrtckmp.internal +import kotlin.js.JsName + @JsName("console") internal external object Console { fun log(message: String)