Fix #5451 : java.lang.IllegalStateException - Media player has not been previously initialized #16657
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contains jobs corresponding to Gradle tests (particularly Robolectric unit tests). | |
name: Unit Tests (Robolectric -- Gradle) | |
# Controls when the action will run. Triggers the workflow on pull request | |
# events or push events in the develop branch. | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
# Push events on develop branch | |
- develop | |
# This workflow has the following jobs: | |
# robolectric_tests: Robolectric tests for all modules except the app module | |
# app_tests: Non-flaky Robolectric tests for the app module | |
jobs: | |
robolectric_tests: | |
name: Non-app Module Robolectric Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ~/.gradle | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-jars-{{ checksum "build.gradle" }} | |
- name: Set up JDK 1.9 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.9 | |
- name: Check Java version & path | |
run: | | |
which java | |
java -version | |
echo "Java home: $JAVA_HOME" | |
$JAVA_HOME/bin/java -version | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./gradlew --full-stacktrace androidDependencies -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Check Gradle environment | |
run: ./gradlew -Dorg.gradle.java.home=$JAVA_HOME -v | |
- name: Build App | |
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 | |
run: sudo ./gradlew --full-stacktrace assembleDebug -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Utility tests | |
if: always() | |
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 | |
run: sudo ./gradlew --full-stacktrace :utility:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Upload Utility Test Reports | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status | |
with: | |
name: utility reports | |
path: utility/build/reports | |
- name: Data tests | |
if: always() | |
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 | |
run: sudo ./gradlew --full-stacktrace :data:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Upload Data Test Reports | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status | |
with: | |
name: data reports | |
path: data/build/reports | |
- name: Domain tests | |
if: always() | |
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 | |
run: sudo ./gradlew --full-stacktrace :domain:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Upload Domain Test Reports | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status | |
with: | |
name: domain reports | |
path: domain/build/reports | |
- name: Testing tests | |
if: always() | |
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 | |
run: sudo ./gradlew --full-stacktrace :testing:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Upload Testing Test Reports | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status | |
with: | |
name: testing reports | |
path: testing/build/reports | |
run_app_module_test: | |
name: Run app module Robolectric test shard | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
shard: [shard0, shard1, shard2, shard3, shard4, shard5, shard6, shard7] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-jars-{{ checksum "build.gradle" }} | |
- name: Set up JDK 1.9 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.9 | |
- name: Check Java version & path | |
run: | | |
which java | |
java -version | |
echo "Java home: $JAVA_HOME" | |
$JAVA_HOME/bin/java -version | |
- name: Check Gradle environment | |
run: ./gradlew -Dorg.gradle.java.home=$JAVA_HOME -v | |
- name: Robolectric tests - App Module | |
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58 | |
run: | | |
sudo ./gradlew --full-stacktrace :app:testDebugUnitTest --${{ matrix.shard }} -Dorg.gradle.java.home=$JAVA_HOME | |
- name: Upload App Test Reports | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status | |
with: | |
name: app reports ${{ matrix.shard }} | |
path: app/build/reports | |
app_tests: | |
name: App Module Robolectric Tests | |
needs: run_app_module_test | |
if: ${{ always() }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- name: Check tests passed (for tests that ran) | |
if: ${{ needs.run_app_module_test.result != 'success' }} | |
run: exit 1 |