mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-27 10:11:48 -04:00
feat/decoupling (#4685)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
50
.github/workflows/reusable-check.yml
vendored
50
.github/workflows/reusable-check.yml
vendored
@@ -89,30 +89,18 @@ jobs:
|
||||
- name: Determine Tasks
|
||||
id: tasks
|
||||
run: |
|
||||
TASKS=""
|
||||
# Only run Lint and Unit Tests on the first API level and first flavor in the matrix to save time and resources
|
||||
FLAVOR="${{ matrix.flavor }}"
|
||||
FLAVOR_CAP=$(echo $FLAVOR | awk '{print toupper(substr($0,1,1))substr($0,2)}')
|
||||
IS_FIRST_API=$(echo '${{ inputs.api_levels }}' | jq -r '.[0] == ${{ matrix.api_level }}')
|
||||
IS_FIRST_FLAVOR=$(echo '${{ inputs.flavors }}' | jq -r '.[0] == "${{ matrix.flavor }}"')
|
||||
|
||||
if [ "$IS_FIRST_API" = "true" ] && [ "$IS_FIRST_FLAVOR" = "true" ]; then
|
||||
[ "${{ inputs.run_lint }}" = "true" ] && TASKS="$TASKS spotlessCheck detekt "
|
||||
[ "${{ inputs.run_unit_tests }}" = "true" ] && TASKS="$TASKS testDebugUnitTest "
|
||||
fi
|
||||
|
||||
FLAVOR="${{ matrix.flavor }}"
|
||||
if [ "$IS_FIRST_API" = "true" ]; then
|
||||
if [ "$FLAVOR" = "google" ]; then
|
||||
TASKS="$TASKS assembleGoogleDebug "
|
||||
[ "${{ inputs.run_unit_tests }}" = "true" ] && TASKS="$TASKS testGoogleDebugUnitTest "
|
||||
elif [ "$FLAVOR" = "fdroid" ]; then
|
||||
TASKS="$TASKS assembleFdroidDebug "
|
||||
[ "${{ inputs.run_unit_tests }}" = "true" ] && TASKS="$TASKS testFdroidDebugUnitTest "
|
||||
fi
|
||||
fi
|
||||
# Matrix-specific tasks
|
||||
TASKS="assemble${FLAVOR_CAP}Debug "
|
||||
[ "${{ inputs.run_lint }}" = "true" ] && TASKS="$TASKS lint${FLAVOR_CAP}Debug "
|
||||
[ "${{ inputs.run_unit_tests }}" = "true" ] && TASKS="$TASKS test${FLAVOR_CAP}DebugUnitTest "
|
||||
|
||||
# Instrumented Test Tasks
|
||||
if [ "${{ inputs.run_instrumented_tests }}" = "true" ]; then
|
||||
[ "$IS_FIRST_FLAVOR" = "true" ] && TASKS="$TASKS connectedDebugAndroidTest "
|
||||
if [ "$FLAVOR" = "google" ]; then
|
||||
TASKS="$TASKS connectedGoogleDebugAndroidTest "
|
||||
elif [ "$FLAVOR" = "fdroid" ]; then
|
||||
@@ -120,20 +108,22 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run coverage report if unit tests were executed
|
||||
if [ "${{ inputs.run_unit_tests }}" = "true" ] && [ "$IS_FIRST_API" = "true" ]; then
|
||||
if [ "$IS_FIRST_FLAVOR" = "true" ]; then
|
||||
TASKS="$TASKS koverXmlReportDebug "
|
||||
fi
|
||||
if [ "$FLAVOR" = "google" ]; then
|
||||
TASKS="$TASKS koverXmlReportGoogleDebug "
|
||||
elif [ "$FLAVOR" = "fdroid" ]; then
|
||||
TASKS="$TASKS koverXmlReportFdroidDebug "
|
||||
fi
|
||||
# Run coverage report for this flavor
|
||||
if [ "${{ inputs.run_unit_tests }}" = "true" ]; then
|
||||
TASKS="$TASKS koverXmlReport${FLAVOR_CAP}Debug "
|
||||
fi
|
||||
|
||||
echo "tasks=$TASKS" >> $GITHUB_OUTPUT
|
||||
echo "is_first_api=$IS_FIRST_API" >> $GITHUB_OUTPUT
|
||||
echo "is_first_flavor=$IS_FIRST_FLAVOR" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Code Style & Static Analysis
|
||||
if: steps.tasks.outputs.is_first_api == 'true' && steps.tasks.outputs.is_first_flavor == 'true'
|
||||
run: ./gradlew spotlessCheck detekt -Pci=true
|
||||
|
||||
- name: Shared Unit Tests
|
||||
if: steps.tasks.outputs.is_first_api == 'true' && steps.tasks.outputs.is_first_flavor == 'true' && inputs.run_unit_tests == true
|
||||
run: ./gradlew testDebugUnitTest koverXmlReportDebug -Pci=true --continue
|
||||
|
||||
- name: Enable KVM group perms
|
||||
if: inputs.run_instrumented_tests == true
|
||||
@@ -142,7 +132,7 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: Run Check (with Emulator)
|
||||
- name: Run Flavor Check (with Emulator)
|
||||
if: inputs.run_instrumented_tests == true
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
env:
|
||||
@@ -155,7 +145,7 @@ jobs:
|
||||
disable-animations: true
|
||||
script: ./gradlew ${{ steps.tasks.outputs.tasks }} -Pci=true -PenableComposeCompilerMetrics=true -PenableComposeCompilerReports=true --continue --scan
|
||||
|
||||
- name: Run Check (no Emulator)
|
||||
- name: Run Flavor Check (no Emulator)
|
||||
if: inputs.run_instrumented_tests == false
|
||||
env:
|
||||
VERSION_CODE: ${{ steps.calculate_version_code.outputs.versionCode }}
|
||||
|
||||
Reference in New Issue
Block a user