Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Piasy committed Feb 22, 2025
1 parent 82c9ab5 commit 2ff0571
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 48 deletions.
75 changes: 28 additions & 47 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,51 +43,19 @@ jobs:
distribution: "temurin"
cache: "gradle"
- uses: gradle/actions/setup-gradle@v3
- uses: actions/setup-node@v4
- uses: suisei-cn/[email protected]
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/[email protected]
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/[email protected]
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 -o 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 }}
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 <output path> --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`.
Expand Down

0 comments on commit 2ff0571

Please sign in to comment.