--- name: checks on: push: paths-ignore: - deployment/halt_deployment_marker branches: - main - 'release-branch-*-v*.*-r*' pull_request: paths-ignore: - deployment/halt_deployment_marker branches: - '*' env: TERM: dumb GRADLE_OPTS: "-Dorg.gradle.daemon=false" TMPDIR: "/tmp" jobs: bazel: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6.0.2 - uses: bazel-contrib/setup-bazel@0.18.0 with: bazelisk-cache: true disk-cache: ${{ github.workflow }} repository-cache: true - run: bazel query //... - run: bazel build //... - run: bazel coverage --build_tests_only //... - name: internal checkers run: bazel run //js/checkers -- --root_dir "${{ github.workspace }}" - name: Github Action Linter run: bazel run @multitool//tools/actionlint:cwd -- -config-file "${{ github.workspace }}/.github/actionlint.yaml" - name: Code formatting run: | bazel run //:format if [[ $(git status --porcelain) ]]; then echo "**** run 'bazel run //:format' to fix formatting errors:\n$(git status)\n$(git diff)"; exit 1; fi - name: ensure all bazel binaries are working run: bazel query 'kind('js_binary', //...) union kind('java_binary', //...)' | xargs -I %s bazel run %s -- -h || true - name: bazel code-coverage uses: codecov/codecov-action@v5.5.2 with: fail_ci_if_error: false codecov_yml_path: "${{ github.workspace }}/codecov_bazel.yml" directory: "${{ github.workspace }}/bazel-out" flags: tooling-unit-test name: "job-name-${{ github.run_id }}" verbose: true static-checks: runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - uses: actions/checkout@v6.0.2 with: fetch-depth: 2 - uses: actions/setup-java@v5.2.0 with: distribution: 'temurin' java-version: '21' - uses: android-actions/setup-android@v3.2.2 with: cmdline-tools-version: 13114758 - name: Install NDK run: echo "y" | sdkmanager "ndk;29.0.14206865" - uses: gradle/actions/setup-gradle@v5 - name: setup run: ./scripts/ci/ci_setup.sh - name: check run: ./scripts/ci/ci_check.sh - name: fix-fs if: always() run: ./scripts/ci/ci_fix_fs.sh - uses: ./.github/actions/collect-reports if: always() with: file_pattern: checkstyle*.html output_folder: collected_reports/checkstyle - uses: actions/upload-artifact@v6.0.0 if: always() continue-on-error: true with: name: checks-reports path: collected_reports linters: runs-on: ubuntu-24.04 timeout-minutes: 20 steps: - uses: actions/checkout@v6.0.2 with: fetch-depth: 2 - uses: actions/setup-java@v5.2.0 with: distribution: 'temurin' java-version: '21' - uses: android-actions/setup-android@v3.2.2 with: cmdline-tools-version: 13114758 - name: Install NDK run: echo "y" | sdkmanager "ndk;29.0.14206865" - uses: gradle/actions/setup-gradle@v5 - name: setup run: ./scripts/ci/ci_setup.sh - name: check run: ./scripts/ci/ci_check_lint.sh - name: check-oom-due-to-lint-issue if: always() continue-on-error: true run: | echo "repo ls:" ls -al echo "logs ls:" ls /var/log grep -i 'killed process' /var/log/messages || true grep -i 'killed process' /var/log/syslog || true grep -i 'oom' /var/log/messages || true grep -i 'oom' /var/log/syslog || true grep -i 'out of memory' /var/log/messages || true grep -i 'out of memory' /var/log/syslog || true - name: fix-fs if: always() run: ./scripts/ci/ci_fix_fs.sh - uses: ./.github/actions/collect-reports if: always() with: file_pattern: lint-results-*.html output_folder: collected_reports/lint - uses: ./.github/actions/collect-reports if: always() with: file_pattern: java_*.hprof output_folder: oom_dumps - uses: actions/upload-artifact@v6.0.0 if: always() continue-on-error: true with: name: linters-reports path: collected_reports tests: runs-on: ubuntu-24.04 timeout-minutes: 15 strategy: matrix: shard_variant: [addons_0, addons_1, addons_2, app, app_all_sdks, app_all_addons, non_app] include: - extra_args: "" tasks: "testDebugUnitTest,testDebugUnitTestCoverage" - shard_variant: app_all_sdks tasks: "testDebugUnitTest" extra_args: "--tests=\"*AllSdkTest*\" ime:app:testDebugUnitTestCoverage" actual_shard: app - shard_variant: app tasks: "testDebugUnitTest" extra_args: "-PexcludeTestClasses=\"**/*AllSdkTest*\" ime:app:testDebugUnitTestCoverage" - shard_variant: app_all_addons extra_args: "--tests=\"*LoadedKeyboardsVerificationTest*\" ime:app:testAllAddOnsUnitTestCoverage" tasks: "testAllAddOnsUnitTest" actual_shard: app steps: - uses: actions/checkout@v6.0.2 with: fetch-depth: 2 - uses: actions/setup-java@v5.2.0 with: distribution: 'temurin' java-version: '21' - uses: android-actions/setup-android@v3.2.2 with: cmdline-tools-version: 13114758 - name: Install NDK run: echo "y" | sdkmanager "ndk;29.0.14206865" - uses: gradle/actions/setup-gradle@v5 - name: setup run: ./scripts/ci/ci_setup.sh - name: setup robolectric run: ./scripts/download_robolectric_jars_to_machine.sh - name: generate projects list for sharding run: ./gradlew projects | grep Project > /tmp/projects.lst - name: shard run: python3 scripts/modules_sharder.py /tmp/projects.lst "$PWD" ${{ matrix.actual_shard || matrix.shard_variant }} ${{ matrix.tasks }} /tmp/gradle.tasks.lst - name: tests run: ./gradlew $(cat /tmp/gradle.tasks.lst) ${{ matrix.extra_args }} - name: Android code-coverage uses: codecov/codecov-action@v5.5.2 with: fail_ci_if_error: false codecov_yml_path: "${{ github.workspace }}/codecov_android.yml" directory: "${{ github.workspace }}/build/jacoco" flags: android-unit-test name: "job-name-${{ github.run_id }}" verbose: true - name: fix-fs if: always() run: ./scripts/ci/ci_fix_fs.sh - uses: ./.github/actions/collect-reports if: always() with: file_pattern: "**/build/reports/tests/**" - uses: actions/upload-artifact@v6.0.0 if: always() continue-on-error: true with: name: tests-${{ matrix.shard_variant }} path: collected_reports - uses: actions/upload-artifact@v6.0.0 if: always() continue-on-error: true with: name: tests-build-logging-${{ matrix.shard_variant }} path: build/build-logging deploy-dry-run: runs-on: ubuntu-24.04 timeout-minutes: 30 env: KEY_STORE_FILE_PASSWORD: password KEY_STORE_FILE_DEFAULT_ALIAS_PASSWORD: alias_password strategy: matrix: shard_type: [binaries_0, binaries_1, binaries_2, app] include: - supports_canary: false supports_logo: true - shard_type: app supports_canary: true supports_logo: false steps: - uses: actions/checkout@v6.0.2 with: fetch-depth: 2 - uses: actions/setup-java@v5.2.0 with: distribution: 'temurin' java-version: '21' - uses: android-actions/setup-android@v3.2.2 with: cmdline-tools-version: 13114758 - name: Install NDK run: echo "y" | sdkmanager "ndk;29.0.14206865" - name: Install ImageMagick run: sudo apt-get install -y imagemagick - uses: gradle/actions/setup-gradle@v5 - name: setup run: ./scripts/ci/ci_setup.sh - name: generate projects list for sharding run: ./gradlew projects | grep Project > /tmp/projects.lst - name: addons-logos if: ${{ matrix.supports_logo }} run: | python3 scripts/modules_sharder.py /tmp/projects.lst "$PWD" ${{ matrix.shard_type }} generateStoreLogoIcon /tmp/gradle.tasks_logo.lst ./gradlew $(cat /tmp/gradle.tasks_logo.lst) - name: setup-keystore run: | mkdir -p $HOME/.android/ cp ./.github/actions/deploy/debug.keystore $HOME/.android/ cp .github/actions/deploy/release_test.keystore /tmp/anysoftkeyboard.keystore - name: shard run: | python3 scripts/modules_sharder.py /tmp/projects.lst "$PWD" ${{ matrix.shard_type }} assembleRelease /tmp/gradle.tasks_assemble.lst python3 scripts/modules_sharder.py /tmp/projects.lst "$PWD" ${{ matrix.shard_type }} bundleRelease,signDebugBundle /tmp/gradle.tasks_bundle.lst python3 scripts/modules_sharder.py /tmp/projects.lst "$PWD" ${{ matrix.shard_type }} generateReleasePlayResources /tmp/gradle.tasks_play.lst - name: dry-run-release-build run: | ./gradlew -PwithAutoVersioning -DdeployChannel=production -PonlyPublishSupporting=production \ $(cat /tmp/gradle.tasks_assemble.lst) ./gradlew -PwithAutoVersioning -DdeployChannel=production -PonlyPublishSupporting=production \ $(cat /tmp/gradle.tasks_bundle.lst) ./gradlew -PwithAutoVersioning -DdeployChannel=production -PonlyPublishSupporting=production \ $(cat /tmp/gradle.tasks_play.lst) - name: dry-run-canary-build if: ${{ matrix.supports_canary }} run: | python3 scripts/modules_sharder.py /tmp/projects.lst "$PWD" ${{ matrix.shard_type }} assembleCanary,bundleCanary,generateCanaryPlayResources /tmp/gradle.tasks_canary.lst ./gradlew -PwithAutoVersioning -DdeployChannel=canart -PonlyPublishSupporting=canary \ $(cat /tmp/gradle.tasks_canary.lst) - name: fix-fs if: always() run: ./scripts/ci/ci_fix_fs.sh - uses: actions/upload-artifact@v6.0.0 continue-on-error: true with: name: fdroid-metadata-dry-run-${{ matrix.shard_type }} path: outputs/fdroid - uses: actions/upload-artifact@v6.0.0 continue-on-error: true with: name: binaries-dry-run-${{ matrix.shard_type }} path: outputs/apk all-green-requirement: needs: [static-checks, linters, tests, deploy-dry-run, bazel] if: always() runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6.0.2 - uses: bazel-contrib/setup-bazel@0.18.0 with: bazelisk-cache: true disk-cache: ${{ github.workflow }} repository-cache: true - name: checking if all passed run: | echo '${{ toJSON(needs) }}' > "${{ runner.temp }}/needs_context.json" cat "${{ runner.temp }}/needs_context.json" bazel run //js/check_all_green -- --github_event_file "${{ runner.temp }}/needs_context.json" deploy-request: if: github.event_name == 'push' needs: [all-green-requirement] runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6.0.2 - uses: ./.github/actions/deploy-request with: gh_user: ${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }} gh_token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }} refname: ${{ github.ref_name }} deploy_mode: force_new merge-to-main: if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-branch-') needs: [all-green-requirement] runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6.0.2 with: token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }} fetch-depth: 0 ref: main - name: create-merge-commit run: ./scripts/ci/ci_merge_to_default_branch.sh ${{ github.ref }} - name: Create pull request uses: peter-evans/create-pull-request@v8.1.0 with: token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }} commit-message: 'Merge to default branch from ${{ github.ref_name }}.' title: 'Automated Merge to default branch from ${{ github.ref_name }}.' committer: 'Polyglot ' author: 'Polyglot ' body: 'Generated from commit ${{ github.sha }} on ${{ github.ref }}.' team-reviewers: maintainers branch: 'bot-pr/merge-to-default-branch-from-${{ github.ref_name }}' base: main delete-branch: true