From d2d3a8eb793c1ca2b91633564956db4f70a2a39d Mon Sep 17 00:00:00 2001 From: Piasy Date: Sat, 22 Feb 2025 18:01:50 +0800 Subject: [PATCH] fix ci --- .github/workflows/ci.yaml | 75 +++++++++++++++------------------------ README.md | 35 +++++++++++++++++- 2 files changed, 62 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index df98027..cc38a05 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,20 @@ permissions: jobs: build: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - cmd: "./gradlew :kmp-webrtc:testDebugUnitTest" + os: macos-latest + dep: "brew update && brew install unzip" + - cmd: "./gradlew :example:androidApp:assembleDebug" + os: macos-latest + dep: "brew update && brew install unzip" + - cmd: "cd example/iosApp && xcodegen && pod install && xcodebuild -workspace iosApp.xcworkspace -scheme iosApp -sdk iphonesimulator -configuration Debug" + os: macos-latest + dep: "brew update && brew install cocoapods xcodegen unzip" + runs-on: ${{ matrix.os }} permissions: pull-requests: write contents: write @@ -30,51 +43,19 @@ jobs: distribution: "temurin" cache: "gradle" - uses: gradle/actions/setup-gradle@v3 - - uses: actions/setup-node@v4 + - uses: suisei-cn/actions-download-file@v1.6.0 + id: download_libs # Remember to give an ID if you need the output filename + name: Download libs.zip with: - node-version: 14 - - name: Setup Test Env + url: "https://github.com/HackWebRTC/kmp-webrtc/releases/latest/download/libs.zip" + target: ./ + - name: Extract libs run: | - cd kmp-socketio/src/jvmTest/resources/ - npm install - - name: Run Jvm tests - run: | - ./gradlew :kmp-socketio:jvmTest --info - - name: Gen coverage - run: | - ./gradlew koverXmlReport - - name: Add coverage to PR - id: jacoco - uses: madrapps/jacoco-report@v1.7.1 - with: - paths: ${{ github.workspace }}/kmp-socketio/build/reports/kover/report.xml - token: ${{ secrets.GITHUB_TOKEN }} - min-coverage-overall: 80 - min-coverage-changed-files: 80 - pass-emoji: ":white_check_mark:" - fail-emoji: ":negative_squared_cross_mark:" - - name: Overall coverage check - if: ${{ steps.jacoco.outputs.coverage-overall < 80 || steps.jacoco.outputs.coverage-changed-files < 80 }} - uses: actions/github-script@v7 - with: - script: | - core.setFailed("Coverage check failed! overall ${{ steps.jacoco.outputs.coverage-overall }}, diff ${{ steps.jacoco.outputs.coverage-changed-files }}.") - - name: Create coverage summary json - uses: jsdaniell/create-json@v1.2.3 - with: - dir: kmp-socketio/build/reports/kover/ - name: "coverage.json" - json: '{"total":{"instructions":{"pct":${{ steps.jacoco.outputs.coverage-overall }} }}}' - - name: Create Coverage Badges - uses: jaywcjlove/coverage-badges-cli@main - with: - source: ${{ github.workspace }}/kmp-socketio/build/reports/kover/coverage.json - output: dist/badges.svg - jsonPath: total.instructions.pct - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - if: ${{ github.ref == 'refs/heads/main' }} - with: - commit_message: ${{ github.event.head_commit.message }} - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist + unzip libs.zip + - if: ${{ matrix.dep }} + run: ${{ matrix.dep }} + - if: ${{ matrix.os == 'windows-latest' }} + shell: cmd + run: ${{ matrix.cmd }} + - if: ${{ matrix.os != 'windows-latest' }} + run: ${{ matrix.cmd }} diff --git a/README.md b/README.md index 60dd1e3..f7a870b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ KMP wrapper for WebRTC. -![Maven Central Version](https://img.shields.io/maven-central/v/com.piasy/kmp-webrtc) +![Maven Central Version](https://img.shields.io/maven-central/v/com.piasy/kmp-webrtc)![Main branch status](https://github.com/HackWebRTC/kmp-webrtc/actions/workflows/ci.yaml/badge.svg?branch=main) ## Supported platforms @@ -66,6 +66,39 @@ pod install # open iosApp.xcworkspace in Xcode, and run it. ``` +## Build WebRTC + +### Android + +```bash +# on Linux +./sdk/build_android_libs.sh --skip-build-ffmpeg + +# on macOS, copy prebuilt_libs into sdk/android_gradle/webrtc/ +# then build aar like this: +pushd ../webrtc_repo/webrtc_ios/src/sdk/android_gradle/ && \ +./gradlew :webrtc:assembleRelease && \ +cp webrtc/build/outputs/aar/webrtc-release.aar \ + ../../../../../kmp-webrtc/libs/android/webrtc.aar && \ +popd +``` + +### iOS + +```bash +pushd ../webrtc_repo/webrtc_ios/src/ && \ +./sdk/build_ios_framework.sh ../../../kmp-webrtc/libs --skip-build-ffmpeg && \ +popd +``` + +### Upload libs zip + +```bash +zip -ry build/libs.zip libs +``` + +Then upload build/libs.zip to GitHub releases. + ## Publish Maven central portal credentials and signing configs are set in `~/.gradle/gradle.properties`.