-
Notifications
You must be signed in to change notification settings - Fork 80
184 lines (166 loc) · 7.97 KB
/
android.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Android CI
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- 'LICENSE'
- 'NOTICE'
- '.gitignore'
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'
- 'LICENSE'
- 'NOTICE'
- '.gitignore'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client-sdk-android
steps:
- name: checkout client-sdk-android
uses: actions/[email protected]
with:
path: ./client-sdk-android
submodules: recursive
- name: set up JDK 17
uses: actions/[email protected]
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Gradle clean
run: ./gradlew clean
- name: Spotless check
if: github.event_name == 'pull_request'
run: |
git fetch origin main --depth 1
./gradlew spotlessCheck
- name: Build with Gradle
run: ./gradlew assembleRelease livekit-android-test:testRelease
# TODO: Figure out appropriate place to run this. Takes ~3 mins, so pretty slow.
# # generates coverage-report.md and publishes as checkrun
# - name: JaCoCo Code Coverage Report
# id: jacoco_reporter
# uses: PavanMudigonda/[email protected]
# with:
# coverage_results_path: "client-sdk-android/livekit-android-sdk/build/jacoco/jacoco.xml"
# coverage_report_name: Coverage
# coverage_report_title: JaCoCo
# github_token: ${{ secrets.GITHUB_TOKEN }}
# skip_check_run: false
# minimum_coverage: 60
# fail_below_threshold: false
# publish_only_summary: false
#
# # Publish Coverage Job Summary
# - name: Add Coverage Job Summary
# run: echo "${{ steps.jacoco_reporter.outputs.coverageSummary }}" >> $GITHUB_STEP_SUMMARY
#
# # uploads the coverage-report.md artifact
# - name: Upload Code Coverage Artifacts
# uses: actions/upload-artifact@v2
# with:
# name: code-coverage-report-markdown
# path: "*/coverage-results.md"
# retention-days: 7
- name: Import video test keys into gradle properties
if: github.event_name == 'push'
run: |
sed -i -e "s,livekitUrl=,livekitUrl=$LIVEKIT_URL,g" gradle.properties
sed -i -e "s,livekitApiKey=,livekitApiKey=$LIVEKIT_API_KEY,g" gradle.properties
sed -i -e "s,livekitApiSecret=,livekitApiSecret=$LIVEKIT_API_SECRET,g" gradle.properties
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
- name: Build video test app
if: github.event_name == 'push'
run: ./gradlew video-encode-decode-test:assembleDebug video-encode-decode-test:assembleDebugAndroidTest
- name: Video Encode Decode App upload and Set app id in environment variable.
if: github.event_name == 'push'
run: |
APP_UPLOAD_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" -X POST https://api-cloud.browserstack.com/app-automate/upload -F "file=@video-encode-decode-test/build/outputs/apk/debug/video-encode-decode-test-debug.apk")
echo "APP_UPLOAD_RESPONSE: $APP_UPLOAD_RESPONSE"
APP_ID=$(echo $APP_UPLOAD_RESPONSE | jq -r ".app_url")
if [ $APP_ID != null ]; then
echo "Apk uploaded to BrowserStack with app id : $APP_ID";
echo "BROWSERSTACK_APP_ID=$APP_ID" >> $GITHUB_ENV;
echo "Setting value of BROWSERSTACK_APP_ID in environment variables to $APP_ID";
else
UPLOAD_ERROR_MESSAGE=$(echo $APP_UPLOAD_RESPONSE | jq -r ".error")
echo "App upload failed, reason : ",$UPLOAD_ERROR_MESSAGE
exit 1;
fi
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
- name: Video Encode Decode Test Suite upload and Set test suite id in environment variable.
if: github.event_name == 'push'
run: |
APP_UPLOAD_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" -X POST https://api-cloud.browserstack.com/app-automate/espresso/v2/test-suite -F "file=@video-encode-decode-test/build/outputs/apk/androidTest/debug/video-encode-decode-test-debug-androidTest.apk")
echo "APP_UPLOAD_RESPONSE: $APP_UPLOAD_RESPONSE"
APP_ID=$(echo $APP_UPLOAD_RESPONSE | jq -r ".test_suite_url")
if [ $APP_ID != null ]; then
echo "Test Suite Apk uploaded to BrowserStack with id: $APP_ID";
echo "BROWSERSTACK_TEST_ID=$APP_ID" >> $GITHUB_ENV;
echo "Setting value of BROWSERSTACK_TEST_ID in environment variables to $APP_ID";
else
UPLOAD_ERROR_MESSAGE=$(echo $APP_UPLOAD_RESPONSE | jq -r ".error")
echo "App upload failed, reason : ",$UPLOAD_ERROR_MESSAGE
exit 1;
fi
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
- name: Trigger BrowserStack tests
if: github.event_name == 'push'
run: |
TEST_RESPONSE=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" -X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" -d '{"deviceLogs": true, "app": "'"$BROWSERSTACK_APP_ID"'", "testSuite": "'"$BROWSERSTACK_TEST_ID"'", "devices": ["Samsung Galaxy Tab S7-10.0","Samsung Galaxy S22-12.0", "Samsung Galaxy S21-12.0","Samsung Galaxy S20-10.0", "Google Pixel 6-12.0", "Google Pixel 5-11.0", "Google Pixel 3-10.0", "OnePlus 7-9.0","Xiaomi Redmi Note 8-9.0", "Huawei P30-9.0"]}' -H "Content-Type: application/json")
echo "TEST_RESPONSE: $TEST_RESPONSE"
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
- name: get version name
if: github.event_name == 'push'
run: echo "::set-output name=version_name::$(cat gradle.properties | grep VERSION_NAME | cut -d "=" -f2)"
id: version_name
- name: Create gpg key and import into gradle properties
if: github.event_name == 'push' && contains(steps.version_name.outputs.version_name,'SNAPSHOT')
run: |
echo $GPG_KEY_ARMOR | base64 --decode > ./release.asc
gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc
sed -i -e "s,nexusUsername=,nexusUsername=$NEXUS_USERNAME,g" gradle.properties
sed -i -e "s,nexusPassword=,nexusPassword=$NEXUS_PASSWORD,g" gradle.properties
sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties
sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties
sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties
sed -i -e "s,STAGING_PROFILE_ID=,STAGING_PROFILE_ID=$PROFILE_ID,g" gradle.properties
env:
GPG_KEY_ARMOR: "${{ secrets.SIGNING_KEY_ARMOR }}"
GPG_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
GPG_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
PROFILE_ID: ${{ secrets.STAGING_PROFILE_ID }}
- name: Publish snapshot
if: github.event_name == 'push' && contains(steps.version_name.outputs.version_name,'SNAPSHOT')
run: ./gradlew publish
- name: Repository Dispatch
if: github.event_name == 'push'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.E2E_DISPATCH_TOKEN }}
repository: livekit/e2e-android
event-type: client-sdk-android-push
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'