Skip to content

Commit fb59111

Browse files
committed
fix ci
1 parent 82c9ab5 commit fb59111

File tree

2 files changed

+61
-49
lines changed

2 files changed

+61
-49
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ permissions:
1515

1616
jobs:
1717
build:
18-
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- cmd: "./gradlew :kmp-webrtc:testDebugUnitTest"
23+
os: macos-latest
24+
- cmd: "./gradlew :example:androidApp:assembleDebug"
25+
os: macos-latest
26+
- cmd: "./gradlew :kmp-webrtc:podspec :kmp-webrtc:generateDummyFramework && cd example/iosApp && xcodegen && pod install && xcodebuild -workspace iosApp.xcworkspace -scheme iosApp -sdk iphonesimulator -configuration Debug"
27+
os: macos-latest
28+
dep: "brew update && brew install cocoapods xcodegen"
29+
runs-on: ${{ matrix.os }}
1930
permissions:
2031
pull-requests: write
2132
contents: write
@@ -30,51 +41,19 @@ jobs:
3041
distribution: "temurin"
3142
cache: "gradle"
3243
- uses: gradle/actions/setup-gradle@v3
33-
- uses: actions/setup-node@v4
34-
with:
35-
node-version: 14
36-
- name: Setup Test Env
37-
run: |
38-
cd kmp-socketio/src/jvmTest/resources/
39-
npm install
40-
- name: Run Jvm tests
44+
- uses: suisei-cn/actions-download-file@v1.6.0
45+
id: download_libs # Remember to give an ID if you need the output filename
46+
name: Download libs.zip
47+
with:
48+
url: "https://github.com/HackWebRTC/kmp-webrtc/releases/latest/download/libs.zip"
49+
target: ./
50+
- if: ${{ matrix.dep }}
51+
run: ${{ matrix.dep }}
52+
- name: Extract libs
4153
run: |
42-
./gradlew :kmp-socketio:jvmTest --info
43-
- name: Gen coverage
44-
run: |
45-
./gradlew koverXmlReport
46-
- name: Add coverage to PR
47-
id: jacoco
48-
uses: madrapps/jacoco-report@v1.7.1
49-
with:
50-
paths: ${{ github.workspace }}/kmp-socketio/build/reports/kover/report.xml
51-
token: ${{ secrets.GITHUB_TOKEN }}
52-
min-coverage-overall: 80
53-
min-coverage-changed-files: 80
54-
pass-emoji: ":white_check_mark:"
55-
fail-emoji: ":negative_squared_cross_mark:"
56-
- name: Overall coverage check
57-
if: ${{ steps.jacoco.outputs.coverage-overall < 80 || steps.jacoco.outputs.coverage-changed-files < 80 }}
58-
uses: actions/github-script@v7
59-
with:
60-
script: |
61-
core.setFailed("Coverage check failed! overall ${{ steps.jacoco.outputs.coverage-overall }}, diff ${{ steps.jacoco.outputs.coverage-changed-files }}.")
62-
- name: Create coverage summary json
63-
uses: jsdaniell/create-json@v1.2.3
64-
with:
65-
dir: kmp-socketio/build/reports/kover/
66-
name: "coverage.json"
67-
json: '{"total":{"instructions":{"pct":${{ steps.jacoco.outputs.coverage-overall }} }}}'
68-
- name: Create Coverage Badges
69-
uses: jaywcjlove/coverage-badges-cli@main
70-
with:
71-
source: ${{ github.workspace }}/kmp-socketio/build/reports/kover/coverage.json
72-
output: dist/badges.svg
73-
jsonPath: total.instructions.pct
74-
- name: Deploy
75-
uses: peaceiris/actions-gh-pages@v4
76-
if: ${{ github.ref == 'refs/heads/main' }}
77-
with:
78-
commit_message: ${{ github.event.head_commit.message }}
79-
github_token: ${{ secrets.GITHUB_TOKEN }}
80-
publish_dir: ./dist
54+
unzip -o libs.zip
55+
- if: ${{ matrix.os == 'windows-latest' }}
56+
shell: cmd
57+
run: ${{ matrix.cmd }}
58+
- if: ${{ matrix.os != 'windows-latest' }}
59+
run: ${{ matrix.cmd }}

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
KMP wrapper for WebRTC.
44

5-
![Maven Central Version](https://img.shields.io/maven-central/v/com.piasy/kmp-webrtc)
5+
![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)
66

77
## Supported platforms
88

@@ -66,6 +66,39 @@ pod install
6666
# open iosApp.xcworkspace in Xcode, and run it.
6767
```
6868

69+
## Build WebRTC
70+
71+
### Android
72+
73+
```bash
74+
# on Linux
75+
./sdk/build_android_libs.sh <output path> --skip-build-ffmpeg
76+
77+
# on macOS, copy prebuilt_libs into sdk/android_gradle/webrtc/
78+
# then build aar like this:
79+
pushd ../webrtc_repo/webrtc_ios/src/sdk/android_gradle/ && \
80+
./gradlew :webrtc:assembleRelease && \
81+
cp webrtc/build/outputs/aar/webrtc-release.aar \
82+
../../../../../kmp-webrtc/libs/android/webrtc.aar && \
83+
popd
84+
```
85+
86+
### iOS
87+
88+
```bash
89+
pushd ../webrtc_repo/webrtc_ios/src/ && \
90+
./sdk/build_ios_framework.sh ../../../kmp-webrtc/libs --skip-build-ffmpeg && \
91+
popd
92+
```
93+
94+
### Upload libs zip
95+
96+
```bash
97+
zip -ry build/libs.zip libs
98+
```
99+
100+
Then upload build/libs.zip to GitHub releases.
101+
69102
## Publish
70103

71104
Maven central portal credentials and signing configs are set in `~/.gradle/gradle.properties`.

0 commit comments

Comments
 (0)