test: migrate Compose UI tests from androidTest to commonTest (#5091)

This commit is contained in:
James Rich 2026-04-12 15:20:00 -05:00 committed by GitHub
parent 4156acf297
commit a11dee42a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 296 additions and 597 deletions

View file

@ -1,108 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"
on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-24.04' }}
if: github.repository == 'meshtastic/Meshtastic-Android'
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: java-kotlin
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v6
# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1
- name: Java Setup
uses: actions/setup-java@v5
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'
token: ${{ github.token }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"

View file

@ -21,8 +21,6 @@ jobs:
with:
run_lint: true
run_unit_tests: false
run_instrumented_tests: false
run_desktop_builds: false
api_levels: '[35]'
upload_artifacts: true
secrets: inherit

View file

@ -18,8 +18,6 @@ jobs:
with:
run_lint: true
run_unit_tests: true
run_instrumented_tests: true
api_levels: '[26, 35]' # Comprehensive testing for Merge Queue
upload_artifacts: false
secrets: inherit

View file

@ -99,9 +99,9 @@ jobs:
PY
# 2. VALIDATION & BUILD: Delegate to reusable-check.yml
# We disable instrumented tests, coverage, and desktop builds for PRs to keep
# feedback fast (< 10 mins). Desktop compilation is already covered by the
# :desktop:test task in the shard-app test shard.
# We disable coverage and desktop builds for PRs to keep feedback fast
# (< 10 mins). Desktop compilation is already covered by the :desktop:test
# task in the shard-app test shard.
validate-and-build:
needs: check-changes
if: needs.check-changes.outputs.android == 'true'
@ -109,10 +109,8 @@ jobs:
with:
run_lint: true
run_unit_tests: true
run_instrumented_tests: false
run_coverage: false
run_desktop_builds: false
api_levels: '[35]'
upload_artifacts: true
secrets: inherit

View file

@ -9,15 +9,9 @@ on:
run_unit_tests:
type: boolean
default: true
run_instrumented_tests:
type: boolean
default: true
run_coverage:
type: boolean
default: true
api_levels:
type: string
default: '[35]'
run_desktop_builds:
type: boolean
default: true
@ -238,7 +232,7 @@ jobs:
**/build/test-results
retention-days: 7
# ── Android Build & Instrumented Tests ──────────────────────────────
# ── Android Build ────────────────────────────────────────────────────
android-check:
runs-on: ubuntu-24.04
permissions:
@ -247,10 +241,6 @@ jobs:
needs: lint-check
env:
VERSION_CODE: ${{ needs.lint-check.outputs.version_code }}
strategy:
fail-fast: true
matrix:
api_level: ${{ fromJson(inputs.api_levels) }}
steps:
- name: Checkout code
@ -265,99 +255,25 @@ jobs:
gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache_read_only: ${{ needs.lint-check.outputs.cache_read_only }}
- name: Determine matrix metadata
id: matrix_meta
shell: bash
run: |
first_api=$(python3 - <<'PY'
import json
print(json.loads('${{ inputs.api_levels }}')[0])
PY
)
if [[ "${{ matrix.api_level }}" == "$first_api" ]]; then
echo "is_first_api=true" >> "$GITHUB_OUTPUT"
else
echo "is_first_api=false" >> "$GITHUB_OUTPUT"
fi
- name: Determine Android tasks
id: tasks
shell: bash
run: |
tasks=(
"app:assembleFdroidDebug"
"app:assembleGoogleDebug"
)
if [[ "${{ inputs.run_instrumented_tests }}" == "true" ]]; then
tasks+=(
"app:connectedFdroidDebugAndroidTest"
"app:connectedGoogleDebugAndroidTest"
)
fi
printf 'tasks=%s\n' "${tasks[*]}" >> "$GITHUB_OUTPUT"
- name: Enable KVM group perms
if: inputs.run_instrumented_tests == true
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run Android Build & Instrumented Tests
if: inputs.run_instrumented_tests == true
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api_level }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew ${{ steps.tasks.outputs.tasks }} -Pci=true --parallel --configuration-cache --continue --scan
- name: Run Android Build
if: inputs.run_instrumented_tests == false
run: ./gradlew ${{ steps.tasks.outputs.tasks }} -Pci=true --parallel --configuration-cache --continue --scan
- name: Upload instrumented test results to Codecov
if: ${{ !cancelled() && inputs.run_instrumented_tests && steps.matrix_meta.outputs.is_first_api == 'true' }}
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: meshtastic/Meshtastic-Android
flags: android-instrumented
fail_ci_if_error: false
report_type: test_results
files: "**/build/outputs/androidTest-results/**/*.xml"
- name: Build Android APKs
run: ./gradlew app:assembleFdroidDebug app:assembleGoogleDebug -Pci=true --parallel --configuration-cache --continue --scan
- name: Upload debug artifact
if: ${{ steps.matrix_meta.outputs.is_first_api == 'true' && inputs.upload_artifacts }}
if: ${{ inputs.upload_artifacts }}
uses: actions/upload-artifact@v7
with:
name: app-debug-apks
path: app/build/outputs/apk/*/debug/*.apk
retention-days: 14
retention-days: 7
- name: Report App Size
if: ${{ always() && steps.matrix_meta.outputs.is_first_api == 'true' }}
if: always()
run: |
echo "### App Size Report" >> $GITHUB_STEP_SUMMARY
echo "| Artifact | Size |" >> $GITHUB_STEP_SUMMARY
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
find app/build/outputs/apk -name "*.apk" -exec du -h {} + | awk '{print "| " $2 " | " $1 " |"}' >> $GITHUB_STEP_SUMMARY
- name: Upload Android reports
if: ${{ always() && inputs.upload_artifacts }}
uses: actions/upload-artifact@v7
with:
name: reports-android-api-${{ matrix.api_level }}
path: |
**/build/outputs/androidTest-results
retention-days: 7
if-no-files-found: ignore
# ── Desktop Build ───────────────────────────────────────────────────
build-desktop:
name: Build Desktop Debug (${{ matrix.os }})