From 1abb640512e9ebe236d82bbd6cbbbe19dcb3769f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Wed, 25 Feb 2026 22:24:48 +0000 Subject: [PATCH] [PM-32758] ci: Improve CI cache to fix GitHub runners running out of memory (#6583) --- .../actions/setup-android-build/action.yml | 23 +--- .github/workflows/build-authenticator.yml | 81 +----------- .github/workflows/build-testharness.yml | 41 +----- .github/workflows/build.yml | 118 +----------------- .github/workflows/test.yml | 45 +------ gradle.properties | 2 +- settings.gradle.kts | 7 -- 7 files changed, 20 insertions(+), 297 deletions(-) diff --git a/.github/actions/setup-android-build/action.yml b/.github/actions/setup-android-build/action.yml index c0e13b3e92..7bf43fecc3 100644 --- a/.github/actions/setup-android-build/action.yml +++ b/.github/actions/setup-android-build/action.yml @@ -8,27 +8,8 @@ inputs: runs: using: 'composite' steps: - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- + - name: Setup Gradle + uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v5.0.1 - name: Configure Ruby uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 diff --git a/.github/workflows/build-authenticator.yml b/.github/workflows/build-authenticator.yml index 9666ce1d75..9b531d0b1c 100644 --- a/.github/workflows/build-authenticator.yml +++ b/.github/workflows/build-authenticator.yml @@ -31,7 +31,6 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JAVA_VERSION: 21 DISTRIBUTE_TO_FIREBASE: ${{ inputs.distribute-to-firebase || github.event_name == 'push' }} PUBLISH_TO_PLAY_STORE: ${{ inputs.publish-to-play-store || github.event_name == 'push' }} @@ -65,43 +64,8 @@ jobs: with: persist-credentials: false - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env.JAVA_VERSION }} - - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Install Fastlane - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + - name: Setup Android Build + uses: ./.github/actions/setup-android-build - name: Check Authenticator run: bundle exec fastlane check @@ -128,16 +92,6 @@ jobs: with: persist-credentials: false - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Install Fastlane - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - name: Log in to Azure uses: bitwarden/gh-actions/azure-login@main with: @@ -197,40 +151,15 @@ jobs: - name: AZ Logout uses: bitwarden/gh-actions/azure-logout@main + - name: Setup Android Build + uses: ./.github/actions/setup-android-build + - name: Verify Play Store credentials if: ${{ env.PUBLISH_TO_PLAY_STORE }} run: | bundle exec fastlane run validate_play_store_json_key \ json_key:"${{ github.workspace }}/secrets/authenticator_play_store-creds.json" - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env.JAVA_VERSION }} - - name: Update app CI Build info run: | ./scripts/update_app_ci_build_info.sh \ diff --git a/.github/workflows/build-testharness.yml b/.github/workflows/build-testharness.yml index 978177fe36..e5d0663890 100644 --- a/.github/workflows/build-testharness.yml +++ b/.github/workflows/build-testharness.yml @@ -20,7 +20,6 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JAVA_VERSION: 21 permissions: contents: read @@ -53,44 +52,8 @@ jobs: with: persist-credentials: false - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env.JAVA_VERSION }} - - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Install Fastlane - run: | - gem install bundler:2.2.27 - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + - name: Setup Android Build + uses: ./.github/actions/setup-android-build - name: Increment version env: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad0a3a8622..3a22d140cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,6 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JAVA_VERSION: 21 GITHUB_ACTION_RUN_URL: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" DISTRIBUTE_TO_FIREBASE: ${{ inputs.distribute-to-firebase || github.event_name == 'push' }} PUBLISH_TO_PLAY_STORE: ${{ inputs.publish-to-play-store || github.event_name == 'push' }} @@ -67,43 +66,8 @@ jobs: with: persist-credentials: false - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env.JAVA_VERSION }} - - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Install Fastlane - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + - name: Setup Android Build + uses: ./.github/actions/setup-android-build - name: Check run: bundle exec fastlane check @@ -137,16 +101,6 @@ jobs: with: persist-credentials: false - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Install Fastlane - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - name: Log in to Azure uses: bitwarden/gh-actions/azure-login@main with: @@ -199,33 +153,8 @@ jobs: - name: Log out from Azure uses: bitwarden/gh-actions/azure-logout@main - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env.JAVA_VERSION }} + - name: Setup Android Build + uses: ./.github/actions/setup-android-build - name: Update app CI Build info run: | @@ -455,16 +384,6 @@ jobs: with: persist-credentials: false - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Install Fastlane - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - name: Log in to Azure uses: bitwarden/gh-actions/azure-login@main with: @@ -503,33 +422,8 @@ jobs: - name: Log out from Azure uses: bitwarden/gh-actions/azure-logout@main - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env.JAVA_VERSION }} + - name: Setup Android Build + uses: ./.github/actions/setup-android-build - name: Update app CI Build info run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5b1328f61..b39a2d60d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,8 @@ name: Test on: push: branches: - - "main" - - "rc" - - "hotfix-rc" + - main + - release/**/* pull_request: types: [opened, synchronize] merge_group: @@ -13,7 +12,6 @@ on: workflow_dispatch: env: - _JAVA_VERSION: 21 _GITHUB_ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }} jobs: @@ -30,43 +28,8 @@ jobs: with: persist-credentials: false - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 - - - name: Cache Gradle files - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} - restore-keys: | - ${{ runner.os }}-gradle-v2- - - - name: Cache build output - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 - with: - path: | - ${{ github.workspace }}/build-cache - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build- - - - name: Configure Ruby - uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0 - with: - bundler-cache: true - - - name: Configure JDK - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 - with: - distribution: "temurin" - java-version: ${{ env._JAVA_VERSION }} - - - name: Install Fastlane - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + - name: Setup Android Build + uses: ./.github/actions/setup-android-build - name: Build and test env: diff --git a/gradle.properties b/gradle.properties index db574aed28..192341a59b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ kotlin.code.style=official kotlin.compilerArgs=-Xjspecify-annotations=strict, -Xtype-enhancement-improvements-strict-mode org.gradle.caching=true -org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dfile.encoding=UTF-8 org.gradle.parallel=true # Disable build features that are enabled by default and we do not need diff --git a/settings.gradle.kts b/settings.gradle.kts index 2589a00db8..f2c3f2019b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,13 +39,6 @@ dependencyResolutionManagement { } } -buildCache { - local { - isEnabled = true - directory = File(rootDir, "build-cache") - } -} - rootProject.name = "Bitwarden" include( ":annotation",