Skip to content

Fix surface causing null pointer exception on some devices #1026

Fix surface causing null pointer exception on some devices

Fix surface causing null pointer exception on some devices #1026

Workflow file for this run

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 }}"}'