Compare commits

...

13 Commits

Author SHA1 Message Date
Benoit Marty
85eadd49de Try with legacy runner macos-latest 2022-10-17 14:31:09 +02:00
Benoit Marty
d2685526ea Give more memory to the JVM. 2022-10-17 14:29:29 +02:00
Benoit Marty
f1047eb961 To revert with force push 2022-10-17 14:29:29 +02:00
Benoit Marty
07ef81a8d5 Try to use regular managed device (not ATD) 2022-10-17 14:29:29 +02:00
Benoit Marty
53cb4d2df9 Try to remove the workaround 2022-10-17 14:29:29 +02:00
Benoit Marty
a7187a4630 Commented for the CI. 2022-10-17 14:29:29 +02:00
Benoit Marty
7fb5084a35 Try suggestion to unblock GHA 2022-10-17 14:29:29 +02:00
Benoit Marty
9955481f7f Try to fix the licence issue, which was:
Warning: License for package Google APIs ATD Intel x86 Atom System Image not accepted.
WARNING:system-images;android-30;google_atd;x86 package is not installed. Please accept the installationlicence to continue
2022-10-17 14:29:29 +02:00
Benoit Marty
59c8d69bb2 Format 2022-10-17 14:29:29 +02:00
Benoit Marty
6855d836a6 typo 2022-10-17 14:29:29 +02:00
Benoit Marty
5d3e732a03 Try to use Gradle managed devices. CI configuration. 2022-10-17 14:29:29 +02:00
Benoit Marty
d446bfa9d3 Move file to subfolder 2022-10-17 14:29:29 +02:00
Benoit Marty
9e6f615f1c Try to use Gradle managed devices.
https://developer.android.com/studio/test/gradle-managed-devices
2022-10-17 14:29:29 +02:00
7 changed files with 144 additions and 45 deletions

View File

@ -7,16 +7,14 @@ on:
# Enrich gradle.properties for CI/CD # Enrich gradle.properties for CI/CD
env: env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4608m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 4 --no-daemon CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 4 --no-daemon -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
jobs: jobs:
tests: tests:
name: Runs all tests name: Runs all tests
runs-on: buildjet-4vcpu-ubuntu-2204 ## TMP runs-on: buildjet-4vcpu-ubuntu-2204
strategy: runs-on: macos-latest
matrix:
api-level: [28]
# Allow all jobs on main and develop. Just one per PR. # Allow all jobs on main and develop. Just one per PR.
concurrency: concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('unit-tests-{0}', github.ref) }} group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('unit-tests-{0}', github.ref) }}
@ -57,41 +55,15 @@ jobs:
disableRateLimiting: true disableRateLimiting: true
public_baseurl: "http://10.0.2.2:8080/" public_baseurl: "http://10.0.2.2:8080/"
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Run all the codecoverage tests at once - name: Run all the codecoverage tests at once
uses: reactivecircus/android-emulator-runner@v2 run: |
# continue-on-error: true
with:
api-level: ${{ matrix.api-level }}
arch: x86
profile: Nexus 5X
target: playstore
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
# emulator-build: 7425822
script: |
./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES ./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES
./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES ./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES ./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES ./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES
# NB: continue-on-error marks steps.tests.conclusion = 'success' but leaves steps.tests.outcome = 'failure'
### - name: Run all the codecoverage tests at once (retry if emulator failed)
### uses: reactivecircus/android-emulator-runner@v2
### if: always() && steps.tests.outcome == 'failure' # don't run if previous step succeeded.
### with:
### api-level: 28
### arch: x86
### profile: Nexus 5X
### force-avd-creation: false
### emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
### disable-animations: true
### emulator-build: 7425822
### script: |
### ./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES
### ./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
### ./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
### ./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES
- name: Upload Integration Test Report Log - name: Upload Integration Test Report Log
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: always() if: always()

View File

@ -197,7 +197,7 @@ def launchTask = getGradle()
.toLowerCase() .toLowerCase()
if (launchTask.contains("coverage".toLowerCase())) { if (launchTask.contains("coverage".toLowerCase())) {
apply from: 'coverage.gradle' apply from: './tools/gradle/coverage.gradle'
} }
apply plugin: 'org.sonarqube' apply plugin: 'org.sonarqube'

View File

@ -19,6 +19,10 @@ android.enableJetifier=true
android.jetifier.ignorelist=android-base-common,common android.jetifier.ignorelist=android-base-common,common
android.useAndroidX=true android.useAndroidX=true
# Test settings
# Ref: https://developer.android.com/studio/test/gradle-managed-devices#gmd-sharding
# android.experimental.androidTest.numManagedDeviceShards=2
#Project Settings #Project Settings
# Change debugPrivateData to true for debugging # Change debugPrivateData to true for debugging
vector.debugPrivateData=false vector.debugPrivateData=false

View File

@ -1,3 +1,5 @@
import com.android.build.api.dsl.ManagedVirtualDevice
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
@ -76,6 +78,45 @@ android {
testOptions { testOptions {
// Comment to run on Android 12 // Comment to run on Android 12
// execution 'ANDROIDX_TEST_ORCHESTRATOR' // execution 'ANDROIDX_TEST_ORCHESTRATOR'
// Ref: https://developer.android.com/studio/test/gradle-managed-devices
managedDevices {
devices {
// Run test with ./gradlew pixel2api28GplayDebugAndroidTest
pixel2api28(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 28
// To include Google services, use "google". Else "aosp"
systemImageSource = "google"
}
// Run test with ./gradlew pixel2api30GplayDebugAndroidTest
pixel2api30(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 30
// To include Google services, use "google". Else "aosp"
systemImageSource = "google"
}
// Ref: https://developer.android.com/studio/test/gradle-managed-devices#gmd-atd
// Run test with ./gradlew pixel2api30AtdGplayDebugAndroidTest
// Warning: Screenshot tests that depend on hardware rendering currently aren't supported when using ATDs.
pixel2api30Atd(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// ATDs currently support only API level 30.
apiLevel = 30
// You can also specify "google-atd" if you require Google Play Services, else "aosp-atd"
systemImageSource = "google-atd"
}
// there is also a way to create group of devices, but this is not necessary for now:
// https://developer.android.com/studio/test/gradle-managed-devices#gmd-groups
}
}
// On GitHub action, add: -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
} }
buildTypes { buildTypes {

View File

@ -87,5 +87,6 @@ task unitTestsWithCoverage(type: GradleBuild) {
task instrumentationTestsWithCoverage(type: GradleBuild) { task instrumentationTestsWithCoverage(type: GradleBuild) {
startParameter.projectProperties.coverage = [enableTestCoverage: true] startParameter.projectProperties.coverage = [enableTestCoverage: true]
startParameter.projectProperties['android.testInstrumentationRunnerArguments.notPackage'] = 'im.vector.app.ui' startParameter.projectProperties['android.testInstrumentationRunnerArguments.notPackage'] = 'im.vector.app.ui'
tasks = [':vector-app:connectedGplayDebugAndroidTest', ':vector:connectedDebugAndroidTest', 'matrix-sdk-android:connectedDebugAndroidTest'] // tasks = [':vector-app:pixel2api30AtdGplayDebugAndroidTest', ':vector:pixel2api30AtdDebugAndroidTest', 'matrix-sdk-android:pixel2api30AtdDebugAndroidTest']
tasks = [':vector-app:pixel2api30GplayDebugAndroidTest', ':vector:pixel2api30DebugAndroidTest', 'matrix-sdk-android:pixel2api30DebugAndroidTest']
} }

View File

@ -1,4 +1,5 @@
import com.android.build.OutputFile import com.android.build.OutputFile
import com.android.build.api.dsl.ManagedVirtualDevice
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.appdistribution' apply plugin: 'com.google.firebase.appdistribution'
@ -128,7 +129,7 @@ android {
namespace "im.vector.application" namespace "im.vector.application"
// Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use // Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use
// Ref: https://issuetracker.google.com/issues/144111441 // Ref: https://issuetracker.google.com/issues/144111441
ndkVersion "21.3.6528147" // ndkVersion "21.3.6528147"
compileSdk versions.compileSdk compileSdk versions.compileSdk
@ -211,6 +212,45 @@ android {
// Comment to run on Android 12 // Comment to run on Android 12
// execution 'ANDROIDX_TEST_ORCHESTRATOR' // execution 'ANDROIDX_TEST_ORCHESTRATOR'
// Ref: https://developer.android.com/studio/test/gradle-managed-devices
managedDevices {
devices {
// Run test with ./gradlew pixel2api28GplayDebugAndroidTest
pixel2api28(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 28
// To include Google services, use "google". Else "aosp"
systemImageSource = "google"
}
// Run test with ./gradlew pixel2api30GplayDebugAndroidTest
pixel2api30(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 30
// To include Google services, use "google". Else "aosp"
systemImageSource = "google"
}
// Ref: https://developer.android.com/studio/test/gradle-managed-devices#gmd-atd
// Run test with ./gradlew pixel2api30AtdGplayDebugAndroidTest
// Warning: Screenshot tests that depend on hardware rendering currently aren't supported when using ATDs.
pixel2api30Atd(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// ATDs currently support only API level 30.
apiLevel = 30
// You can also specify "google-atd" if you require Google Play Services, else "aosp-atd"
systemImageSource = "google-atd"
}
// there is also a way to create group of devices, but this is not necessary for now:
// https://developer.android.com/studio/test/gradle-managed-devices#gmd-groups
}
}
// On GitHub action, add: -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
} }
signingConfigs { signingConfigs {

View File

@ -1,3 +1,5 @@
import com.android.build.api.dsl.ManagedVirtualDevice
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-parcelize'
@ -31,7 +33,7 @@ android {
namespace "im.vector.app" namespace "im.vector.app"
// Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use // Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use
// Ref: https://issuetracker.google.com/issues/144111441 // Ref: https://issuetracker.google.com/issues/144111441
ndkVersion "21.3.6528147" // ndkVersion "21.3.6528147"
compileSdk versions.compileSdk compileSdk versions.compileSdk
@ -65,6 +67,45 @@ android {
// Comment to run on Android 12 // Comment to run on Android 12
// execution 'ANDROIDX_TEST_ORCHESTRATOR' // execution 'ANDROIDX_TEST_ORCHESTRATOR'
// Ref: https://developer.android.com/studio/test/gradle-managed-devices
managedDevices {
devices {
// Run test with ./gradlew pixel2api28GplayDebugAndroidTest
pixel2api28(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 28
// To include Google services, use "google". Else "aosp"
systemImageSource = "google"
}
// Run test with ./gradlew pixel2api30GplayDebugAndroidTest
pixel2api30(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 30
// To include Google services, use "google". Else "aosp"
systemImageSource = "google"
}
// Ref: https://developer.android.com/studio/test/gradle-managed-devices#gmd-atd
// Run test with ./gradlew pixel2api30AtdGplayDebugAndroidTest
// Warning: Screenshot tests that depend on hardware rendering currently aren't supported when using ATDs.
pixel2api30Atd(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// ATDs currently support only API level 30.
apiLevel = 30
// You can also specify "google-atd" if you require Google Play Services, else "aosp-atd"
systemImageSource = "google-atd"
}
// there is also a way to create group of devices, but this is not necessary for now:
// https://developer.android.com/studio/test/gradle-managed-devices#gmd-groups
}
}
// On GitHub action, add: -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
} }
buildTypes { buildTypes {
debug { debug {