From 6e97f0c333750e7c57a1ac66d2f945c1c59c547f Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:49:04 +0100 Subject: [PATCH 01/14] Add .circleci/config.yml --- .circleci/config.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000000..4175da6cfe9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,26 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/configuration-reference +version: 2.1 + +# Define a job to be invoked later in a workflow. +# See: https://circleci.com/docs/configuration-reference/#jobs +jobs: + say-hello: + # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. + # See: https://circleci.com/docs/configuration-reference/#executor-job + docker: + - image: cimg/base:stable + # Add steps to the job + # See: https://circleci.com/docs/configuration-reference/#steps + steps: + - checkout + - run: + name: "Say hello" + command: "echo Hello, World!" + +# Orchestrate jobs using workflows +# See: https://circleci.com/docs/configuration-reference/#workflows +workflows: + say-hello-workflow: + jobs: + - say-hello From 0c5a50c9a268d55d1b37cb2a7f41f1729cb2f54d Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:53:20 +0000 Subject: [PATCH 02/14] Base CircleCI config prepared Will run with and without build cache in parallel. --- .circleci/config.yml | 62 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4175da6cfe9..095ecef671f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,25 +2,73 @@ # See: https://circleci.com/docs/configuration-reference version: 2.1 +# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +# See: https://circleci.com/docs/orb-intro/ +orbs: + # https://circleci.com/developer/orbs/orb/circleci/android + android: circleci/android@2.3.0 + # Define a job to be invoked later in a workflow. # See: https://circleci.com/docs/configuration-reference/#jobs jobs: - say-hello: + run-tests-with-bitrise-build-cache: # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. # See: https://circleci.com/docs/configuration-reference/#executor-job - docker: - - image: cimg/base:stable + executor: + name: android/android-machine + tag: 2023.11.1 + # Add steps to the job # See: https://circleci.com/docs/configuration-reference/#steps steps: + - android/change-java-version: + java-version: 17 - checkout - run: - name: "Say hello" - command: "echo Hello, World!" + name: Checkout submodules as well + command: | + git "submodule" "update" "--init" "--recursive" "--jobs=10" + - run: + name: Add Build Cache dependency hashes + command: | + ./gradlew --write-verification-metadata sha256 + - android/run-tests: + test-command: ./gradlew :Signal-Android:lintPlayProdDebug + - run: + name: Assemble playProdDebug + command: ./gradlew :Signal-Android:assemblePlayProdDebug + + run-tests-with-without-build-cache: + # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. + # See: https://circleci.com/docs/configuration-reference/#executor-job + executor: + name: android/android-machine + tag: 2023.11.1 + + # Add steps to the job + # See: https://circleci.com/docs/configuration-reference/#steps + steps: + - android/change-java-version: + java-version: 17 + - checkout + - run: + name: Checkout submodules as well + command: | + git "submodule" "update" "--init" "--recursive" "--jobs=10" + - run: + name: Add Build Cache dependency hashes + command: | + ./gradlew --write-verification-metadata sha256 + - android/run-tests: + test-command: ./gradlew :Signal-Android:lintPlayProdDebug + - run: + name: Assemble playProdDebug + command: ./gradlew :Signal-Android:assemblePlayProdDebug # Orchestrate jobs using workflows # See: https://circleci.com/docs/configuration-reference/#workflows workflows: - say-hello-workflow: + run-tests: jobs: - - say-hello + - run-tests-with-bitrise-build-cache + - run-tests-with-without-build-cache \ No newline at end of file From feb52229d65df8273fa9c2e01b63786a0063b22d Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:40:06 +0000 Subject: [PATCH 03/14] Enabled Bitrise Build Cache for Gradle for the run-tests-with-bitrise-build-cache job --- .circleci/config.yml | 2 ++ bitrise-build-cache.gradle | 33 +++++++++++++++++++++++++++++++++ settings.gradle | 4 ++++ 3 files changed, 39 insertions(+) create mode 100644 bitrise-build-cache.gradle diff --git a/.circleci/config.yml b/.circleci/config.yml index 095ecef671f..0995c16704a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,6 +17,8 @@ jobs: executor: name: android/android-machine tag: 2023.11.1 + environment: + ENABLE_BITRISE_BUILD_CACHE: "true" # Add steps to the job # See: https://circleci.com/docs/configuration-reference/#steps diff --git a/bitrise-build-cache.gradle b/bitrise-build-cache.gradle new file mode 100644 index 00000000000..e3ddc0f9b0d --- /dev/null +++ b/bitrise-build-cache.gradle @@ -0,0 +1,33 @@ +buildscript { + repositories { + mavenCentral() + maven { url 'https://jitpack.io' } + } + + dependencies { + classpath 'io.bitrise.gradle:remote-cache:1.+' + } +} + +import io.bitrise.gradle.cache.BitriseBuildCache +import io.bitrise.gradle.cache.BitriseBuildCacheServiceFactory + +println('[BITRISE BUILD CACHE] Gradle Configuration loaded') + +String bitriseBuildCacheWorkspaceID = System.getenv('BITRISE_BUILD_CACHE_WORKSPACE_ID') +boolean isCI = System.getenv().containsKey("CI") +println('[BITRISE BUILD CACHE] isCI: ' + isCI) +buildCache { + local { + enabled = !isCI + } + registerBuildCacheService(BitriseBuildCache.class, BitriseBuildCacheServiceFactory.class) + remote(BitriseBuildCache.class) { + endpoint = System.getenv('BITRISE_BUILD_CACHE_ENDPOINT') ?: 'grpcs://pluggable.services.bitrise.io' + authToken = bitriseBuildCacheWorkspaceID + ':' + System.getenv('BITRISE_BUILD_CACHE_AUTH_TOKEN') + enabled = true + push = isCI + debug = false + blobValidationLevel = 'warning' + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 705c94a6779..7c0e15e4ea2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -95,3 +95,7 @@ project(':glide-webp-app').projectDir = file('glide-webp/app') rootProject.name='Signal' apply from: 'dependencies.gradle' + +if (file("bitrise-build-cache.gradle").exists() && System.getenv("ENABLE_BITRISE_BUILD_CACHE") == "true") { + apply(from: "bitrise-build-cache.gradle") +} From f0dcea9e4aeb42f6d8ccb9adbac1c1ed14ff97cc Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:50:56 +0000 Subject: [PATCH 04/14] Print out the endpoint --- .circleci/config.yml | 4 ++-- bitrise-build-cache.gradle | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0995c16704a..5d03e297eb0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,7 @@ jobs: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug - run-tests-with-without-build-cache: + run-tests-without-build-cache: # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. # See: https://circleci.com/docs/configuration-reference/#executor-job executor: @@ -73,4 +73,4 @@ workflows: run-tests: jobs: - run-tests-with-bitrise-build-cache - - run-tests-with-without-build-cache \ No newline at end of file + - run-tests-without-build-cache \ No newline at end of file diff --git a/bitrise-build-cache.gradle b/bitrise-build-cache.gradle index e3ddc0f9b0d..9e71a7dc4dc 100644 --- a/bitrise-build-cache.gradle +++ b/bitrise-build-cache.gradle @@ -24,6 +24,7 @@ buildCache { registerBuildCacheService(BitriseBuildCache.class, BitriseBuildCacheServiceFactory.class) remote(BitriseBuildCache.class) { endpoint = System.getenv('BITRISE_BUILD_CACHE_ENDPOINT') ?: 'grpcs://pluggable.services.bitrise.io' + println('[BITRISE BUILD CACHE] endpoint: ' + endpoint) authToken = bitriseBuildCacheWorkspaceID + ':' + System.getenv('BITRISE_BUILD_CACHE_AUTH_TOKEN') enabled = true push = isCI From c5e52f892be12f134fa5b59f629d1ff349f7b699 Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:52:09 +0000 Subject: [PATCH 05/14] Enable build caching in gradle.properties --- gradle.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gradle.properties b/gradle.properties index d7cb0fccbdc..c3a1a4a8249 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,6 @@ android.experimental.androidTest.numManagedDeviceShards=4 android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false + +org.gradle.caching=true +#org.gradle.caching.debug=true From 826437b472cbda300c1769601c499b047a60d16c Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:29:32 +0000 Subject: [PATCH 06/14] Increasing no_output_timeout to 30m --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d03e297eb0..e9ba8e61c22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,6 +35,8 @@ jobs: command: | ./gradlew --write-verification-metadata sha256 - android/run-tests: + name: Lint playProdDebug + no_output_timeout: 30m test-command: ./gradlew :Signal-Android:lintPlayProdDebug - run: name: Assemble playProdDebug @@ -62,6 +64,8 @@ jobs: command: | ./gradlew --write-verification-metadata sha256 - android/run-tests: + name: Lint playProdDebug + no_output_timeout: 30m test-command: ./gradlew :Signal-Android:lintPlayProdDebug - run: name: Assemble playProdDebug From d33a978bbd6877a57ff3e85b18320d64ec37f015 Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:36:14 +0000 Subject: [PATCH 07/14] Instead of no_output_timeout use --info log level --- .circleci/config.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e9ba8e61c22..1cc452c85a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,9 +35,7 @@ jobs: command: | ./gradlew --write-verification-metadata sha256 - android/run-tests: - name: Lint playProdDebug - no_output_timeout: 30m - test-command: ./gradlew :Signal-Android:lintPlayProdDebug + test-command: ./gradlew :Signal-Android:lintPlayProdDebug --info - run: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug @@ -64,9 +62,7 @@ jobs: command: | ./gradlew --write-verification-metadata sha256 - android/run-tests: - name: Lint playProdDebug - no_output_timeout: 30m - test-command: ./gradlew :Signal-Android:lintPlayProdDebug + test-command: ./gradlew :Signal-Android:lintPlayProdDebug --info - run: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug From 3952947ca28f5f41512c48cfb2b8f0544b003020 Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Thu, 7 Dec 2023 05:58:08 +0000 Subject: [PATCH 08/14] Removing --info flag --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1cc452c85a7..5d03e297eb0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: command: | ./gradlew --write-verification-metadata sha256 - android/run-tests: - test-command: ./gradlew :Signal-Android:lintPlayProdDebug --info + test-command: ./gradlew :Signal-Android:lintPlayProdDebug - run: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug @@ -62,7 +62,7 @@ jobs: command: | ./gradlew --write-verification-metadata sha256 - android/run-tests: - test-command: ./gradlew :Signal-Android:lintPlayProdDebug --info + test-command: ./gradlew :Signal-Android:lintPlayProdDebug - run: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug From cd04e48562414b696402fcf8c1bcfa94fbbf512c Mon Sep 17 00:00:00 2001 From: gogod3v-eval <138013047+gogod3v-eval@users.noreply.github.com> Date: Thu, 7 Dec 2023 06:23:33 +0000 Subject: [PATCH 09/14] Switch from android/run-tests to run step The run step supports `no_output_timeout` while the orb one doesn't. Added `no_output_timeout: 30m` to the step. --- .circleci/config.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d03e297eb0..dcf2edf20e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,8 +34,10 @@ jobs: name: Add Build Cache dependency hashes command: | ./gradlew --write-verification-metadata sha256 - - android/run-tests: - test-command: ./gradlew :Signal-Android:lintPlayProdDebug + - run: + name: Lint PlayProdDebug + no_output_timeout: 30m + command: ./gradlew :Signal-Android:lintPlayProdDebug - run: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug @@ -61,8 +63,10 @@ jobs: name: Add Build Cache dependency hashes command: | ./gradlew --write-verification-metadata sha256 - - android/run-tests: - test-command: ./gradlew :Signal-Android:lintPlayProdDebug + - run: + name: Lint PlayProdDebug + no_output_timeout: 30m + command: ./gradlew :Signal-Android:lintPlayProdDebug - run: name: Assemble playProdDebug command: ./gradlew :Signal-Android:assemblePlayProdDebug From a09611559eea54cd9c92a0aef39613a572a18375 Mon Sep 17 00:00:00 2001 From: Viktor Benei Date: Thu, 7 Dec 2023 12:55:07 +0100 Subject: [PATCH 10/14] Change jvm max memory to 3g --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c3a1a4a8249..7f54d92d44d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx6g -Xms256m -XX:MaxMetaspaceSize=1g +org.gradle.jvmargs=-Xmx3g -Xms256m -XX:MaxMetaspaceSize=1g android.useAndroidX=true android.enableJetifier=true kapt.incremental.apt=false From 3e2ad7be8186ce369f056cf81f9060ee80f512c3 Mon Sep 17 00:00:00 2001 From: gogod3v <46003678+gogod3v@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:08:07 +0100 Subject: [PATCH 11/14] Update bitrise-build-cache.gradle Added newline --- bitrise-build-cache.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitrise-build-cache.gradle b/bitrise-build-cache.gradle index 9e71a7dc4dc..8044633bd0a 100644 --- a/bitrise-build-cache.gradle +++ b/bitrise-build-cache.gradle @@ -31,4 +31,4 @@ buildCache { debug = false blobValidationLevel = 'warning' } -} \ No newline at end of file +} From 37e05b2f7cbedc7b1c61670139693ca5f0293570 Mon Sep 17 00:00:00 2001 From: gogod3v <46003678+gogod3v@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:50:45 +0100 Subject: [PATCH 12/14] Update config.yml - for now disable assemble and only do lint --- .circleci/config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dcf2edf20e9..54b59d75abd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,9 +38,9 @@ jobs: name: Lint PlayProdDebug no_output_timeout: 30m command: ./gradlew :Signal-Android:lintPlayProdDebug - - run: - name: Assemble playProdDebug - command: ./gradlew :Signal-Android:assemblePlayProdDebug + # - run: + # name: Assemble playProdDebug + # command: ./gradlew :Signal-Android:assemblePlayProdDebug run-tests-without-build-cache: # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. @@ -67,9 +67,9 @@ jobs: name: Lint PlayProdDebug no_output_timeout: 30m command: ./gradlew :Signal-Android:lintPlayProdDebug - - run: - name: Assemble playProdDebug - command: ./gradlew :Signal-Android:assemblePlayProdDebug + # - run: + # name: Assemble playProdDebug + # command: ./gradlew :Signal-Android:assemblePlayProdDebug # Orchestrate jobs using workflows # See: https://circleci.com/docs/configuration-reference/#workflows @@ -77,4 +77,4 @@ workflows: run-tests: jobs: - run-tests-with-bitrise-build-cache - - run-tests-without-build-cache \ No newline at end of file + - run-tests-without-build-cache From 26447b314caaf4e82848b7f82c05109afeab9bdb Mon Sep 17 00:00:00 2001 From: gogod3v <46003678+gogod3v@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:51:25 +0100 Subject: [PATCH 13/14] Update gradle.properties - let's test with JVM 4GB max RAM --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7f54d92d44d..29f2039a17f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx3g -Xms256m -XX:MaxMetaspaceSize=1g +org.gradle.jvmargs=-Xmx4g -Xms256m -XX:MaxMetaspaceSize=1g android.useAndroidX=true android.enableJetifier=true kapt.incremental.apt=false From 36be2d2ed947a4d4c2307e8ebeab0939ced0e299 Mon Sep 17 00:00:00 2001 From: gogod3v <46003678+gogod3v@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:56:05 +0100 Subject: [PATCH 14/14] Increase no_output_timeout to 60m --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 54b59d75abd..1c5828e6595 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ jobs: ./gradlew --write-verification-metadata sha256 - run: name: Lint PlayProdDebug - no_output_timeout: 30m + no_output_timeout: 60m command: ./gradlew :Signal-Android:lintPlayProdDebug # - run: # name: Assemble playProdDebug @@ -65,7 +65,7 @@ jobs: ./gradlew --write-verification-metadata sha256 - run: name: Lint PlayProdDebug - no_output_timeout: 30m + no_output_timeout: 60m command: ./gradlew :Signal-Android:lintPlayProdDebug # - run: # name: Assemble playProdDebug