- Optimize build time for local builds

- Enhance CI/CD workflows (7GB Ram, 2CPU) by adding custom gradle arguments to properly run
- Add unit test UI comment representation plugin
This commit is contained in:
ariskotsomitopoulos 2021-09-08 14:03:51 +03:00
parent 938540d9e9
commit fe1d9aa589
5 changed files with 66 additions and 18 deletions

View file

@ -5,6 +5,12 @@ on:
push: push:
branches: [ main, develop ] branches: [ main, develop ]
# Enrich gradle.properties for CI/CD
env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx2g
-Porg.gradle.parallel=false
jobs: jobs:
debug: debug:
name: Build debug APKs (${{ matrix.target }}) name: Build debug APKs (${{ matrix.target }})
@ -25,7 +31,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Assemble ${{ matrix.target }} debug apk - name: Assemble ${{ matrix.target }} debug apk
run: ./gradlew assemble${{ matrix.target }}Debug --stacktrace run: ./gradlew assemble${{ matrix.target }}Debug $CI_GRADLE_ARG_PROPERTIES --stacktrace
- name: Upload ${{ matrix.target }} debug APKs - name: Upload ${{ matrix.target }} debug APKs
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
@ -39,6 +45,8 @@ jobs:
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# - name: Generate CI gradle.properties
# run: echo "$CI_GRADLE_PROPERTIES" > gradle.properties
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: | path: |
@ -48,7 +56,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Assemble GPlay unsigned apk - name: Assemble GPlay unsigned apk
run: ./gradlew clean assembleGplayRelease --stacktrace run: ./gradlew clean assembleGplayRelease $CI_GRADLE_ARG_PROPERTIES --stacktrace
- name: Upload Gplay unsigned APKs - name: Upload Gplay unsigned APKs
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:

View file

@ -5,6 +5,12 @@ on:
push: push:
branches: [ main, develop ] branches: [ main, develop ]
# Enrich gradle.properties for CI/CD
env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx2g
-Porg.gradle.parallel=false
jobs: jobs:
# Temporary add build of Android tests, which cannot be run on the CI right now, but they need to at least compile # Temporary add build of Android tests, which cannot be run on the CI right now, but they need to at least compile
# So it will be mandatory for this action to be successful on every PRs # So it will be mandatory for this action to be successful on every PRs
@ -22,17 +28,26 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Compile Android tests - name: Compile Android tests
run: ./gradlew clean assembleAndroidTest --stacktrace -PallWarningsAsErrors=false run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false
integration-tests: integration-tests:
name: Integration Tests (Synapse) name: Integration Tests (Synapse)
# env:
# JAVA_HOME: $JAVA_HOME_11_X64
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
api-level: [21, 28, 30] api-level: [21,23, 28, 30]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# - name: Generate CI gradle.properties
# run: echo "$CI_GRADLE_PROPERTIES" > gradle.properties
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Set up Python 3.8 - name: Set up Python 3.8
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
@ -64,5 +79,12 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2 uses: reactivecircus/android-emulator-runner@v2
with: with:
api-level: ${{ matrix.api-level }} api-level: ${{ matrix.api-level }}
#arch: x86_64
#disable-animations: true
# script: ./gradlew -PallWarningsAsErrors=false vector:connectedAndroidTest matrix-sdk-android:connectedAndroidTest # script: ./gradlew -PallWarningsAsErrors=false vector:connectedAndroidTest matrix-sdk-android:connectedAndroidTest
script: ./gradlew -PallWarningsAsErrors=false connectedCheck 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
emulator-build: 7425822
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedCheck --stacktrace

View file

@ -5,6 +5,12 @@ on:
push: push:
branches: [ main, develop ] branches: [ main, develop ]
# Enrich gradle.properties for CI/CD
env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx2g
-Porg.gradle.parallel=false
jobs: jobs:
integration-tests: integration-tests:
name: Sanity Tests (Synapse) name: Sanity Tests (Synapse)
@ -46,5 +52,5 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2 uses: reactivecircus/android-emulator-runner@v2
with: with:
api-level: ${{ matrix.api-level }} api-level: ${{ matrix.api-level }}
script: ./gradlew -PallWarningsAsErrors=false connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest

View file

@ -5,6 +5,12 @@ on:
push: push:
branches: [main, develop] branches: [main, develop]
# Enrich gradle.properties for CI/CD
env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx2g
-Porg.gradle.parallel=false
jobs: jobs:
unit-tests: unit-tests:
name: Run Unit Tests name: Run Unit Tests
@ -20,4 +26,10 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Run unit tests - name: Run unit tests
run: ./gradlew clean test --stacktrace -PallWarningsAsErrors=false run: ./gradlew clean test $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false --stacktrace
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: ./**/build/test-results/**/*.xml
# files: test-results/**/*.xml

View file

@ -6,20 +6,20 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# Enable file system watch (https://docs.gradle.org/6.7/release-notes.html) # Build Time Optimizations
org.gradle.jvmargs=-Xmx3g -Xms512M -XX:MaxPermSize=2048m -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.vfs.watch=true org.gradle.vfs.watch=true
# Android Settings
android.enableJetifier=true
android.useAndroidX=true
#Project Settings
# Change debugPrivateData to true for debugging
vector.debugPrivateData=false vector.debugPrivateData=false
# httpLogLevel values: NONE, BASIC, HEADERS, BODY
vector.httpLogLevel=BASIC vector.httpLogLevel=BASIC
# Note: to debug, you can put and uncomment the following lines in the file ~/.gradle/gradle.properties to override the value above
#vector.debugPrivateData=true
#vector.httpLogLevel=BODY