Try gradle managed devices to speed up instrumentation tests #204
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- 1.x | |
- 2.x | |
pull_request: | |
workflow_dispatch: | |
env: | |
MAIN_BRANCH: ${{ github.ref == 'refs/heads/1.x' || github.ref == 'refs/heads/2.x' }} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ env.MAIN_BRANCH != 'true' }} | |
- name: Build | |
run: > | |
./gradlew | |
buildNonMkdocs -x test -x lint -x detekt -x assembleRelease | |
:plugins:buildPlugins -x detekt | |
--continue | |
- name: Check publication setup | |
run: > | |
./gradlew | |
publishAllPublicationsToOSSRHRepository | |
publishAllPublicationsToSonatypeSnapshotRepository | |
--dry-run | |
--no-parallel | |
- name: Deploy snapshot | |
if: env.MAIN_BRANCH == 'true' && github.repository == 'bumble-tech/appyx' | |
env: | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
run: > | |
./gradlew | |
publishAllPublicationsToSonatypeSnapshotRepository | |
-Psnapshot=true | |
--no-parallel | |
-Psigning.password=${{ secrets.SIGNING_PASSWORD }} | |
-Psonatype.username=${{ secrets.SONATYPE_USERNAME }} | |
-Psonatype.password=${{ secrets.SONATYPE_PASSWORD }} | |
- name: Upload failure artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-reports | |
path: | | |
**/build/reports/ | |
!**/build/reports/dependency-analysis/ | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ env.MAIN_BRANCH != 'true' }} | |
- name: Lint | |
run: > | |
./gradlew mergeLintSarif --continue | |
- uses: github/codeql-action/upload-sarif@v2 | |
if: success() || failure() | |
with: | |
sarif_file: build/lint-merged.sarif | |
category: lint | |
- name: Upload failure artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lint-reports | |
path: | | |
**/build/reports/ | |
!**/build/reports/dependency-analysis/ | |
code-health: | |
name: Code health | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ env.MAIN_BRANCH != 'true' }} | |
- name: Detekt & Project Health | |
run: ./gradlew detekt :plugins:detekt mergeDetektSarif projectHealth --continue | |
- uses: github/codeql-action/upload-sarif@v2 | |
if: success() || failure() | |
with: | |
sarif_file: build/detekt-merged.sarif | |
category: detekt | |
- name: Upload failure artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: detekt-merged.sarif | |
path: | | |
build/detekt-merged.sarif | |
instrumentation-tests: | |
name: Instrumentation tests | |
runs-on: macOS-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ env.MAIN_BRANCH != 'true' }} | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Instrumentation tests | |
# Flags from https://github.com/android/nowinandroid/blob/main/.github/workflows/Build.yaml | |
run: > | |
adb logcat > logcat.out & | |
./gradlew cleanManagedDevices --unused-only && | |
./gradlew pixel2api30DebugAndroidTest | |
-Dorg.gradle.workers.max=1 | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" | |
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true | |
- name: Upload failed instrumentation artifacts | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: instrumentation-failures | |
path: | | |
**/build/reports | |
logcat.out | |
screenshot-tests: | |
name: Screenshot tests | |
runs-on: macOS-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ env.MAIN_BRANCH != 'true' }} | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Screenshot tests | |
# Flags from https://github.com/android/nowinandroid/blob/main/.github/workflows/Build.yaml | |
run: > | |
./gradlew cleanManagedDevices --unused-only && ./gradlew screenshotTestsCompareBaseline | |
-Dorg.gradle.workers.max=1 | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" | |
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true | |
- name: Upload failed screenshot artifacts | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: screenshot-failures | |
path: | | |
**/build/reports | |
logcat.out | |
check-documentation: | |
name: Check documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- run: pip install mkdocs-material | |
- run: pip install mkdocs-macros-plugin | |
- run: pip install mkdocs-redirects | |
- run: mkdocs build --strict |