Skip to content

Improve android.yml to accelerate the CI jobs #870

Improve android.yml to accelerate the CI jobs

Improve android.yml to accelerate the CI jobs #870

Workflow file for this run

name: Android CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
- name: Run Checks
run: ./gradlew check --stacktrace
paparazi-screenshot-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
- name: Run Paparazzi Screenshot Tests
run: ./gradlew :showkase-screenshot-testing-paparazzi-sample:verifyPaparazziDebug -PuseKsp=true --stacktrace
- name: Upload Screenshot Test Report
uses: actions/upload-artifact@v3
if: always()
with:
name: reports
path: showkase-screenshot-testing-paparazzi-sample/build/reports/tests/testDebugUnitTest/
retention-days: 1
- name: Upload Screenshot Failure Differences
uses: actions/upload-artifact@v3
if: failure()
with:
name: reports
path: showkase-screenshot-testing-paparazzi-sample/out/failures/
retention-days: 1
ui-testing:
runs-on: macos-11
strategy:
matrix:
api-level: [ 26, 29 ]
target: [ default, google_apis ]
include:
- api-level: 26
target: default
- api-level: 29
target: google_apis
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
- name: Start emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
script: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true
- name: Run UI Tests w/ KSP
run: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true --continue
- name: Run Screenshot Tests
run: ./gradlew executeScreenshotTests -PdirectorySuffix=Api${{ matrix.api-level }} -PprintBase64
- name: Upload screenshot testing report
uses: actions/upload-artifact@v3
with:
name: reports
path: sample/build/reports/shot/debug/Api${{ matrix.api-level }}/verification/
retention-days: 1
# Uncomment the jobs below if you want to generate and record screenshots. Once you download the
# artifact, place them under sample/screenshots/debug/
# - name: Record screenshots
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ matrix.api-level }}
# target: ${{ matrix.target }}
# arch: x86_64
# script: ./gradlew executeScreenshotTests -PdirectorySuffix=Api${{ matrix.api-level }} -Precord
#
# - name: Upload screenshots in an artifact
# uses: actions/upload-artifact@v3
# with:
# name: Api${{ matrix.api-level }}
# path: sample/screenshots/debug/Api${{ matrix.api-level }}
# retention-days: 1