Skip to content

Merge pull request #4010 from AnySoftKeyboard/bot-pr/github-actions-u… #3888

Merge pull request #4010 from AnySoftKeyboard/bot-pr/github-actions-u…

Merge pull request #4010 from AnySoftKeyboard/bot-pr/github-actions-u… #3888

Workflow file for this run

---
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"
GRADLE_USER_HOME: ".github_cache_gradle/user_home/"
GRADLE_HOME: ".github_cache_gradle/gradle_home/"
TMPDIR: "/tmp"
jobs:
js-checks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.7
with:
fetch-depth: 2
- uses: pnpm/action-setup@v4.0.0
with:
version: 8.6.9
run_install: true
- uses: actions/setup-node@v4.0.2
with:
node-version-file: ".nvmrc"
cache: 'pnpm'
- run: pnpm lint
- run: pnpm pretty
- run: pnpm build
- run: pnpm test
static-checks:
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_ndk:1.20.0
timeout-minutes: 15
steps:
- uses: actions/checkout@v4.1.7
with:
fetch-depth: 2
- uses: actions/cache@v4.0.2
with:
path: .github_cache_gradle/
key: global-v9-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: |
global-v9
- name: setup
run: ./scripts/ci/ci_setup.sh
- name: check
run: ./scripts/ci/ci_check.sh
- name: check-all-yamls
run: ./scripts/ci/ci_check_yamls.sh
- name: verify-version-classes-greps
run: ./scripts/ci/third-party-update/verify-third-party-update-greps.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@v4.3.3
if: always()
continue-on-error: true
with:
name: checks-reports
path: collected_reports
linters:
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_ndk:1.20.0
timeout-minutes: 20
steps:
- uses: actions/checkout@v4.1.7
with:
fetch-depth: 2
- uses: actions/cache@v4.0.2
with:
path: .github_cache_gradle/
key: global-v9-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: |
global-v9
- 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@v4.3.3
if: always()
continue-on-error: true
with:
name: linters-reports
path: collected_reports
tests:
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_ndk:1.20.0
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@v4.1.7
with:
fetch-depth: 2
- uses: actions/cache@v4.0.2
with:
path: .github_cache_gradle/
key: tests-v9-${{ matrix.actual_shard }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: |
tests-v9-${{ matrix.actual_shard }}
global-v9
- 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 }}
- uses: ./.github/actions/codecov
- 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@v4.3.3
if: always()
continue-on-error: true
with:
name: tests-${{ matrix.shard_variant }}
path: collected_reports
- uses: actions/upload-artifact@v4.3.3
if: always()
continue-on-error: true
with:
name: tests-build-logging-${{ matrix.shard_variant }}
path: build/build-logging
deploy-dry-run:
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_ndk:1.20.0
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@v4.1.7
with:
fetch-depth: 2
- uses: actions/cache@v4.0.2
with:
path: .github_cache_gradle/
key: deploy-v9-${{ matrix.shard_type }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: |
deploy-v9-${{ matrix.shard_type }}
global-v9
- 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 /root/.android/ || true
cp ./.github/actions/deploy/debug.keystore /root/.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@v4.3.3
continue-on-error: true
with:
name: fdroid-metadata-dry-run-${{ matrix.shard_type }}
path: outputs/fdroid
all-green-requirement:
needs: [static-checks, linters, tests, deploy-dry-run, js-checks]
runs-on: ubuntu-22.04
steps:
- name: ready
run: echo "DONE"
deploy-request:
if: github.event_name == 'push'
needs: [all-green-requirement]
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_base:1.20.0
steps:
- uses: actions/checkout@v4.1.7
with:
fetch-depth: 2
- uses: ./.github/actions/deploy-request
name: request-new-deploys
with:
sha: ${{ github.sha }}
ref: ${{ github.ref }}
new_deploy: true
api_username: ${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}
api_token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
merge-to-main:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-branch-')
needs: [all-green-requirement]
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_base:1.20.0
steps:
- uses: actions/checkout@v4.1.7
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@v6.0.5
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 <ask@evendanan.net>'
author: 'Polyglot <ask@evendanan.net>'
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