|
| 1 | +name: "Flix Sample Screenshot Tests" |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: |
| 5 | + - ".github/workflows/flix_sample.yml" |
| 6 | + - "Samples/Flix/**" |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + build: |
| 15 | + name: "Build APKs for testing" |
| 16 | + timeout-minutes: 25 |
| 17 | + runs-on: |
| 18 | + labels: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup Java |
| 24 | + uses: actions/setup-java@v4 |
| 25 | + with: |
| 26 | + distribution: "temurin" |
| 27 | + java-version: 21 |
| 28 | + |
| 29 | + - name: Build |
| 30 | + run: | |
| 31 | + echo "Building ..." |
| 32 | + ./gradlew FlixSample:assembleDebug |
| 33 | + ./gradlew FlixSample:assembleDebugAndroidTest |
| 34 | +
|
| 35 | + - name: Upload app apk |
| 36 | + uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: android-app |
| 39 | + path: ./Samples/Flix/build/outputs/apk/debug/FlixSample-debug.apk |
| 40 | + |
| 41 | + - name: Upload test runner apk |
| 42 | + uses: actions/upload-artifact@v4 |
| 43 | + with: |
| 44 | + name: android-test-app |
| 45 | + path: ./Samples/Flix/build/outputs/apk/androidTest/debug/FlixSample-debug-androidTest.apk |
| 46 | + |
| 47 | + screenshot_test: |
| 48 | + name: Run Screenshot Tests ${{ matrix.shard_index }} |
| 49 | + timeout-minutes: 25 |
| 50 | + needs: build |
| 51 | + runs-on: ubuntu-latest |
| 52 | + |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + shard_index: [0, 1] |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Setup Java |
| 62 | + uses: actions/setup-java@v4 |
| 63 | + with: |
| 64 | + distribution: "temurin" |
| 65 | + java-version: 21 |
| 66 | + |
| 67 | + - name: Download app apk |
| 68 | + uses: actions/download-artifact@v4 |
| 69 | + with: |
| 70 | + name: android-app |
| 71 | + path: ./Samples/Flix/build/outputs/apk/debug/ |
| 72 | + |
| 73 | + - name: Determine apk path |
| 74 | + run: | |
| 75 | + echo "app_apk=$(find ./Samples/Flix/build/outputs/apk/debug/*.apk)" >> $GITHUB_ENV |
| 76 | +
|
| 77 | + - name: Download test runner apk |
| 78 | + uses: actions/download-artifact@v4 |
| 79 | + with: |
| 80 | + name: android-test-app |
| 81 | + path: ./Samples/Flix/build/outputs/apk/androidTest/debug/ |
| 82 | + |
| 83 | + - name: Determine test apk path |
| 84 | + run: | |
| 85 | + echo "test_apk=$(find ./Samples/Flix/build/outputs/apk/androidTest/debug/*.apk)" >> $GITHUB_ENV |
| 86 | +
|
| 87 | + - name: Screenshot Tests |
| 88 | + uses: ndtp/android-testify-action@v1 |
| 89 | + with: |
| 90 | + api-level: 29 |
| 91 | + target: google_apis |
| 92 | + arch: x86_64 |
| 93 | + profile: pixel_3a |
| 94 | + shard_count: 2 |
| 95 | + shard_index: ${{ matrix.shard_index }} |
| 96 | + module: ":FlixSample" |
| 97 | + app_apk: ${{ env.app_apk }} |
| 98 | + app_package: "dev.testify.samples.flix" |
| 99 | + test_apk: ${{ env.test_apk }} |
| 100 | + test_package: "dev.testify.samples.flix.test" |
| 101 | + test_runner: "androidx.test.runner.AndroidJUnitRunner" |
| 102 | + verbose: true |
0 commit comments