Skip to content

Commit

Permalink
Improved android.yml version
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaygaba committed Jun 6, 2024
1 parent e21f7b3 commit 8587e8a
Showing 1 changed file with 49 additions and 53 deletions.
102 changes: 49 additions & 53 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,47 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 17
uses: actions/setup-java@v1

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- uses: actions/cache@v1

- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
# Key inspired from here -
# https://medium.com/@ychescale9/running-android-instrumented-tests-on-ci-from-bitrise-io-to-github-actions-a611e57ce71f
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
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@v1

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: Checkout Branch
uses: actions/checkout@v2
- uses: actions/cache@v1

- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
# Key inspired from here -
# https://medium.com/@ychescale9/running-android-instrumented-tests-on-ci-from-bitrise-io-to-github-actions-a611e57ce71f
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
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
Expand All @@ -55,6 +60,7 @@ jobs:
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()
Expand All @@ -69,48 +75,42 @@ jobs:
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@v1

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: Checkout Branch
uses: actions/checkout@v2
- uses: actions/cache@v1

- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
# Key inspired from here -
# https://medium.com/@ychescale9/running-android-instrumented-tests-on-ci-from-bitrise-io-to-github-actions-a611e57ce71f
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle

- name: Run UI Tests w/ KAPT
- name: Start emulator
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-build: 7425822
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
script: ./gradlew connectedCheck --no-daemon --stacktrace --debug
script: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true

- name: Run UI Tests w/ KSP
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-build: 7425822
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
script: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true --debug
run: ./gradlew connectedCheck --no-daemon --stacktrace -PuseKsp=true --continue

- name: Run Screenshot Tests
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-build: 7425822
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
script: ./gradlew executeScreenshotTests -PdirectorySuffix=Api${{ matrix.api-level }} -PprintBase64
run: ./gradlew executeScreenshotTests -PdirectorySuffix=Api${{ matrix.api-level }} -PprintBase64

- name: Upload screenshot testing report
uses: actions/upload-artifact@v3
Expand All @@ -119,13 +119,12 @@ jobs:
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/
# 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:
# emulator-build: 7425822
# api-level: ${{ matrix.api-level }}
# target: ${{ matrix.target }}
# arch: x86_64
Expand All @@ -137,6 +136,3 @@ jobs:
# name: Api${{ matrix.api-level }}
# path: sample/screenshots/debug/Api${{ matrix.api-level }}
# retention-days: 1



0 comments on commit 8587e8a

Please sign in to comment.