diff --git a/.github/workflows/blueprints.yaml b/.github/workflows/blueprints.yaml index 6d217358a..f8aaa2a01 100644 --- a/.github/workflows/blueprints.yaml +++ b/.github/workflows/blueprints.yaml @@ -10,8 +10,8 @@ on: jobs: build: - runs-on: ubuntu-latest - timeout-minutes: 30 + runs-on: macos-latest + timeout-minutes: 45 steps: - name: Checkout @@ -33,47 +33,164 @@ jobs: ~/.gradle/caches/build-cache-* key: gradle-${{ hashFiles('checksum.txt') }} - - name: Build project + - name: Build project Mock and UnitTest + run: ./gradlew assembleMockDebug assembleProdDebug compileMockDebugUnitTestKotlin + + - name: Spotless + run: ./gradlew spotlessCheck + + - name: Robolectric Mock + run: ./gradlew testMockDebugUnitTest + + - name: Build project Prod and UnitTest + run: ./gradlew assembleMockDebug assembleProdDebug compileProdDebugUnitTestKotlin + + - name: Robolectric Prod run: ./gradlew spotlessCheck assembleMockDebug assembleProdDebug testMockDebugUnitTest testProdDebugUnitTest --stacktrace - - name: Upload build reports - if: always() - uses: actions/upload-artifact@v2 - with: - name: build-reports - path: app/build/reports/ +# test: +# needs: build +# runs-on: macOS-latest # enables hardware acceleration in the virtual machine +# timeout-minutes: 30 +# strategy: +# matrix: +# api-level: [23, 29] +# +# steps: +# - name: Checkout +# uses: actions/checkout@v2 +# +# - name: Copy CI gradle.properties +# run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties +# +# - name: Set up JDK 11 +# uses: actions/setup-java@v1 +# with: +# java-version: 11 +# - test: - needs: build - runs-on: macOS-latest # enables hardware acceleration in the virtual machine - timeout-minutes: 30 - strategy: - matrix: - api-level: [23, 29] +# +# - name: Upload test reports +# if: always() +# uses: actions/upload-artifact@v2 +# with: +# name: test-reports +# path: app/build/reports/ - steps: - - name: Checkout - uses: actions/checkout@v2 +# +# gradleManagedVirtualDevicesTest: +# needs: build +# runs-on: macos-latest +# timeout-minutes: 30 +# +# steps: +# - name: Checkout +# uses: actions/checkout@v2 +# +# - name: Copy CI gradle.properties +# run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties +# +# - name: Set up JDK 11 +# uses: actions/setup-java@v1 +# with: +# java-version: 11 - - name: Copy CI gradle.properties - run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + # Needed to accept licenses + - name: Setup Android SDK + uses: android-actions/setup-android@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 +# - name: Generate cache key for Gradle cache +# run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt +# +# - uses: actions/cache@v2 +# with: +# path: | +# ~/.gradle/caches/modules-* +# ~/.gradle/caches/jars-* +# ~/.gradle/caches/build-cache-* +# key: gradle-${{ hashFiles('checksum.txt') }} + +# - name: Cache pixel2api30 system image +# uses: actions/cache@v2 +# with: +# path: | +# ~/.android/gradle/avd/dev30_aosp-atd_x86_Pixel_2.avd.* +# key: pixel2api30 +# +# - name: Cache pixel2api27 system image +# uses: actions/cache@v2 +# with: +# path: ~/.android/gradle/avd/dev27_aosp_x86_Pixel_2.* +# key: pixel2api27 +# +# - name: Cache nexus9api29 system image +# uses: actions/cache@v2 +# with: +# path: ~/.android/gradle/avd/dev29_aosp_x86_Nexus_9.* +# key: nexus9api29 + +# - name: Run all tests pixel 2 api 27 ATD +# working-directory: ${{ env.SAMPLE_PATH }} +# run: ./gradlew pixel2api27atdMockDebugAndroidTest +# +# - name: Run all tests nexus 9 api 29 ATD +# working-directory: ${{ env.SAMPLE_PATH }} +# run: ./gradlew nexus9api29atdMockDebugAndroidTest + + - name: Compile AndroidTests Mock + run: ./gradlew compileMockDebugAndroidTestKotlin + + - name: Run all tests pixel 2 api 30 ATD + working-directory: . + run: ./gradlew -Pandroid.sdk.channel=3 -Pandroid.experimental.androidTest.numManagedDeviceShards=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" pixel2api30atdMockDebugAndroidTest + + - name: Run all tests pixel 2 api 30 ATD again + working-directory: . + run: ./gradlew -Pandroid.sdk.channel=3 -Pandroid.experimental.androidTest.numManagedDeviceShards=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" pixel2api30atdMockDebugAndroidTest + + - name: Run all tests pixel 2 api 30 non-atd + working-directory: . + run: ./gradlew -Pandroid.sdk.channel=3 -Pandroid.experimental.androidTest.numManagedDeviceShards=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" pixel2api30MockDebugAndroidTest + + - name: Run all tests pixel 2 api 30 non-atd again + working-directory: . + run: ./gradlew -Pandroid.sdk.channel=3 -Pandroid.experimental.androidTest.numManagedDeviceShards=1 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" pixel2api30MockDebugAndroidTest + + - name: Run instrumentation tests API 30 + uses: reactivecircus/android-emulator-runner@v2 with: - java-version: 11 + api-level: 30 + arch: x86_64 + disable-animations: true + script: ./gradlew app:cMDAT --stacktrace - - name: Run instrumentation tests + - name: Run instrumentation tests API 30 ATD uses: reactivecircus/android-emulator-runner@v2 with: - api-level: ${{ matrix.api-level }} + api-level: 30 arch: x86 + channel: canary + target: aosp_atd disable-animations: true script: ./gradlew app:cMDAT --stacktrace - - name: Upload test reports + - name: Upload build reports if: always() uses: actions/upload-artifact@v2 with: - name: test-reports + name: build-reports path: app/build/reports/ + + - name: Upload all outputs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: outputs + path: app/build/outputs/ + +# - name: Upload test reports +# if: always() +# uses: actions/upload-artifact@v2 +# with: +# name: test-reports +# path: ./app/build/reports/androidTests/managedDevice/ diff --git a/app/build.gradle b/app/build.gradle index 63c1749e9..4ad9355f1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -102,6 +102,39 @@ android { composeOptions { kotlinCompilerExtensionVersion "$composeVersion" } + + testOptions { + devices { + pixel2api30atd(com.android.build.api.dsl.ManagedVirtualDevice) { + // Use device profiles you typically see in Android Studio + device = "Pixel 2" + apiLevel = 30 + // You can also specify "google" if you require Google Play Services. + systemImageSource = "aosp-atd" + abi = "x86" + } + pixel2api30(com.android.build.api.dsl.ManagedVirtualDevice) { + // Use device profiles you typically see in Android Studio + device = "Pixel 2" + apiLevel = 30 + // You can also specify "google" if you require Google Play Services. + systemImageSource = "aosp" + abi = "x86" + } + pixel2api27(com.android.build.api.dsl.ManagedVirtualDevice) { + device = "Pixel 2" + apiLevel = 27 + systemImageSource = "aosp" + abi = "x86" + } + nexus9api29(com.android.build.api.dsl.ManagedVirtualDevice) { + device = "Nexus 9" + apiLevel = 29 + systemImageSource = "aosp" + abi = "x86" + } + } + } } /* diff --git a/build.gradle b/build.gradle index 2aa44df30..1be8cbde6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.3.0-alpha07' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2..41d9927a4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ef6cd1cac..41dfb8790 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Feb 18 13:22:47 CET 2022 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists