|
1 | | -name: OpenDocument-Reader-Android |
| 1 | +name: build_test |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | 5 | push: |
6 | | - paths-ignore: |
7 | | - - '**.md' |
8 | | - - '.github/**' |
9 | | - - '!.github/workflows/android_main.yml' |
10 | 6 |
|
11 | 7 | concurrency: |
12 | 8 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
|
49 | 45 | - name: conan profile |
50 | 46 | run: conan profile detect |
51 | 47 |
|
| 48 | + - name: Gradle cache |
| 49 | + uses: gradle/actions/setup-gradle@v3 |
| 50 | + |
52 | 51 | - name: gradle |
53 | 52 | run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace |
54 | 53 |
|
| 54 | + - name: conan cache size |
| 55 | + run: du -h -d1 ~/.conan2/p |
| 56 | + - name: conan login |
| 57 | + run: conan remote login odr admin --password '${{ secrets.ARTIFACTORY }}' |
| 58 | + - name: conan upload |
| 59 | + run: conan upload "*" --check --confirm --remote odr |
| 60 | + |
55 | 61 | - name: Artifact APKs |
56 | 62 | uses: actions/upload-artifact@v4 |
57 | 63 | with: |
@@ -117,42 +123,43 @@ jobs: |
117 | 123 | - name: conan profile |
118 | 124 | run: conan profile detect |
119 | 125 |
|
| 126 | + - name: Gradle cache |
| 127 | + uses: gradle/actions/setup-gradle@v3 |
| 128 | + |
| 129 | + - name: AVD cache |
| 130 | + uses: actions/cache@v4 |
| 131 | + id: avd-cache |
| 132 | + with: |
| 133 | + path: | |
| 134 | + ~/.android/avd/* |
| 135 | + ~/.android/adb* |
| 136 | + key: avd-${{ matrix.api-level }}-v2 |
| 137 | + |
120 | 138 | - name: Enable KVM group perms |
121 | 139 | run: | |
122 | 140 | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
123 | 141 | sudo udevadm control --reload-rules |
124 | 142 | sudo udevadm trigger --name-match=kvm |
125 | 143 |
|
126 | | - - name: Run tests |
| 144 | + - name: Create AVD and generate snapshot for caching |
| 145 | + if: steps.avd-cache.outputs.cache-hit != 'true' |
127 | 146 | uses: reactivecircus/android-emulator-runner@v2 |
128 | 147 | with: |
129 | | - force-avd-creation: false |
130 | | - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save |
131 | 148 | api-level: ${{ matrix.api-level }} |
132 | 149 | arch: ${{ matrix.arch }} |
133 | 150 | target: google_apis |
134 | | - script: | |
135 | | - mkdir -p testResults/screenshots |
136 | | - adb logcat > testResults/logcat.txt & |
137 | | -
|
138 | | - adb shell screencap /data/local/tmp/beforeTests.png |
139 | | - adb pull /data/local/tmp/beforeTests.png testResults/screenshots/ |
140 | | -
|
141 | | - bundle exec fastlane tests || touch sorry_but_tests_are_failing |
142 | | - adb pull /sdcard/Pictures/screenshots testResults/ || true |
143 | | -
|
144 | | - adb shell screencap /data/local/tmp/afterTests.png |
145 | | - adb pull /data/local/tmp/afterTests.png testResults/screenshots/ |
146 | | -
|
147 | | - mv app/build/reports/androidTests/connected testResults/ |
148 | | - mv app/build/outputs/androidTest-results testResults/ |
149 | | -
|
150 | | - test ! -f sorry_but_tests_are_failing |
| 151 | + force-avd-creation: false |
| 152 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 153 | + disable-animations: false |
| 154 | + script: echo "Generated AVD snapshot for caching." |
151 | 155 |
|
152 | | - - name: upload test results |
153 | | - uses: actions/upload-artifact@v4 |
154 | | - if: always() |
| 156 | + - name: Run tests |
| 157 | + uses: reactivecircus/android-emulator-runner@v2 |
155 | 158 | with: |
156 | | - name: testResults-${{ matrix.api-level }}-${{ matrix.arch }} |
157 | | - path: testResults |
158 | | - if-no-files-found: error |
| 159 | + api-level: ${{ matrix.api-level }} |
| 160 | + arch: ${{ matrix.arch }} |
| 161 | + target: google_apis |
| 162 | + force-avd-creation: false |
| 163 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 164 | + disable-animations: true |
| 165 | + script: ./gradlew connectedCheck |
0 commit comments