Skip to content

Change android test runner to ubuntu #134

Change android test runner to ubuntu

Change android test runner to ubuntu #134

Workflow file for this run

name: Main Branch CI/CD
on:
push:
branches:
- 'main'
jobs:
test:
runs-on: ubuntu-latest
env:
CCDROIDX_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEYSTORE_PASSWORD }}
CCDROIDX_RELEASE_KEY_ALIAS: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS }}
CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD }}
CCDROIDX_RELEASE_KEYSTORE_PATH: release.keystore
GOOGLE_SERVICE_JSON: ${{ secrets.GOOGLE_SERVICE_JSON }}
steps:
- uses: actions/checkout@v3
- name: Stub release keystore file
run: |
touch release.keystore
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Decrypt google service json
run: |
TMP_GOOGLE_SERVICE_JSON_DIR="${RUNNER_TEMP}"/play
mkdir "${TMP_GOOGLE_SERVICE_JSON_DIR}"
echo $GOOGLE_SERVICE_JSON | base64 -di > "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json
mv "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json app/google-services.json
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Lint check
run: ./gradlew lint
- name: Upload lint reports
uses: actions/upload-artifact@v3
with:
name: lint-reports
path: '**/build/reports/lint-results-*.html'
- name: Unit Test
run: ./gradlew testFlossDebugUnitTest testFullDebugUnitTest testDebugUnitTest
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-unit
path: '**/build/reports/tests/test*UnitTest'
androidTest:
runs-on: ubuntu-latest
env:
CCDROIDX_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEYSTORE_PASSWORD }}
CCDROIDX_RELEASE_KEY_ALIAS: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS }}
CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD }}
CCDROIDX_RELEASE_KEYSTORE_PATH: release.keystore
GOOGLE_SERVICE_JSON: ${{ secrets.GOOGLE_SERVICE_JSON }}
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Stub release keystore file
run: |
touch release.keystore
- name: Decrypt google service json
run: |
TMP_GOOGLE_SERVICE_JSON_DIR="${RUNNER_TEMP}"/play
mkdir "${TMP_GOOGLE_SERVICE_JSON_DIR}"
echo $GOOGLE_SERVICE_JSON | base64 -D > "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json
mv "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json app/google-services.json
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Build AndroidTest apps
run: ./gradlew packageFlossDebug packageFlossDebugAndroidTest packageFullDebug packageFullDebugAndroidTest
- name: Run Android Test
run: ./gradlew testDevicesGroupFlossDebugAndroidTest --no-parallel --max-workers=1
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
- name: Upload Android test reports
uses: actions/upload-artifact@v3
with:
name: test-reports-GMD
path: '**/build/reports/androidTests/managedDevice/debug/flavors'
screenshotTest:
runs-on: macos-14
env:
CCDROIDX_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEYSTORE_PASSWORD }}
CCDROIDX_RELEASE_KEY_ALIAS: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS }}
CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD: ${{ secrets.CCDROIDX_RELEASE_KEY_ALIAS_PASSWORD }}
CCDROIDX_RELEASE_KEYSTORE_PATH: release.keystore
GOOGLE_SERVICE_JSON: ${{ secrets.GOOGLE_SERVICE_JSON }}
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Stub release keystore file
run: |
touch release.keystore
- name: Decrypt google service json
run: |
TMP_GOOGLE_SERVICE_JSON_DIR="${RUNNER_TEMP}"/play
mkdir "${TMP_GOOGLE_SERVICE_JSON_DIR}"
echo $GOOGLE_SERVICE_JSON | base64 -D > "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json
mv "${TMP_GOOGLE_SERVICE_JSON_DIR}"/google-services.json app/google-services.json
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Verify Screenshot
id: verifyScreenshot
run: ./gradlew app:verifyRoborazziFlossDebug
- name: Compare Screenshot
id: compare-screenshot
if: always() && (steps.verifyScreenshot.outcome == 'failure')
run: ./gradlew app:compareRoborazziFlossDebug
- name: Upload Android test reports
if: always() && (steps.verifyScreenshot.outcome == 'failure')
uses: actions/upload-artifact@v3
with:
name: test-reports-screenshot
path: '**/build/outputs/roborazzi'