Updates the open on phone behavior in the Wear OS app #459
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| # Ensure that only the latest commit is tested for PRs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_test_lint: | |
| name: "Build, Test, and Lint" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write # Needed for git-auto-commit-action | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| # Add cache-encryption-key if you set up the GRADLE_ENCRYPTION_KEY secret | |
| # with: | |
| # cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| - name: Decode google-services.json | |
| env: | |
| DEBUG_GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_BASE64 }} | |
| run: | | |
| if [ -z "$DEBUG_GOOGLE_SERVICES_JSON_BASE64" ]; then | |
| echo "DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. Copying test-google-services.json." | |
| cp test-google-services.json app/google-services.json | |
| else | |
| echo "Decoding DEBUG_GOOGLE_SERVICES_JSON_BASE64." | |
| echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json | |
| fi | |
| - name: Apply Spotless | |
| run: ./gradlew spotlessApply | |
| - name: Commit Spotless changes | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: 🤖 Apply Spotless formatting | |
| file_pattern: '**/*.kt **/*.kts **/*.java **/*.xml' | |
| - name: Build debug APK | |
| run: ./gradlew assembleDebug --no-configuration-cache | |
| - name: Verify Screenshot Tests (AndroidX) | |
| run: ./gradlew validateDebugScreenshotTest | |
| - name: Run local unit tests | |
| run: ./gradlew testDebugUnitTest | |
| - name: Check lint | |
| run: ./gradlew lintDebug | |
| - name: Upload build outputs (APKs) | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: APKs | |
| path: '**/build/outputs/apk/debug/*.apk' | |
| - name: Upload JVM local test results (XML) | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: local-test-results | |
| path: '**/build/test-results/test*UnitTest/TEST-*.xml' | |
| - name: Upload lint reports (HTML) | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lint-reports-html | |
| path: '**/build/reports/lint-results-debug.html' | |
| androidTest: | |
| name: "Instrumentation Tests (emulator)" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: | |
| api-level: [26] | |
| steps: | |
| - name: Delete unnecessary tools 🔧 | |
| uses: jlumbroso/[email protected] | |
| with: | |
| android: false # Don't remove Android tools | |
| tool-cache: true # Remove image tool cache | |
| dotnet: true | |
| haskell: true | |
| swap-storage: true | |
| - name: Enable KVM group perms | |
| 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: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Copy CI gradle.properties | |
| run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Decode google-services.json | |
| env: | |
| DEBUG_GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_BASE64 }} | |
| run: | | |
| if [ -z "$DEBUG_GOOGLE_SERVICES_JSON_BASE64" ]; then | |
| echo "DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. Copying test-google-services.json." | |
| cp test-google-services.json app/google-services.json | |
| else | |
| echo "Decoding DEBUG_GOOGLE_SERVICES_JSON_BASE64." | |
| echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json | |
| fi | |
| - name: Build | |
| run: ./gradlew assembleDebug assembleDebugAndroidTest | |
| - name: Build projects and run instrumentation tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| arch: x86 | |
| disable-animations: true | |
| disk-size: 6000M | |
| heap-size: 600M | |
| script: ./gradlew connectedDebugAndroidTest | |
| - name: Upload test reports | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports-${{ matrix.api-level }} | |
| path: '**/build/reports/androidTests' |