update kotlin #150
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: "Android CI" | |
| on: | |
| push: | |
| paths-ignore: | |
| - '**/*.md' | |
| - '.github/workflows/codeql-analysis.yml' | |
| - '.github/workflows/close-empty-xml.yml' | |
| - '.github/workflows/stale.yml' | |
| - '.github/workflows/compare-src.yml' | |
| - '.github/ISSUE_TEMPLATE/**' | |
| pull_request: | |
| paths-ignore: | |
| - '**/*.md' | |
| - '.github/workflows/codeql-analysis.yml' | |
| - '.github/workflows/close-empty-xml.yml' | |
| - '.github/workflows/stale.yml' | |
| - '.github/workflows/compare-src.yml' | |
| - '.github/ISSUE_TEMPLATE/**' | |
| workflow_dispatch: {} | |
| jobs: | |
| ktlint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Common setup | |
| uses: ./.github/actions/common-setup | |
| - name: ktlint check | |
| run: bash ./gradlew ktlintCheck --stacktrace | |
| - name: Upload ktlint report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ktlint-report | |
| path: app/build/reports/ktlint | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Common setup | |
| uses: ./.github/actions/common-setup | |
| - name: lint | |
| run: bash ./gradlew lintDebug --stacktrace | |
| - name: Upload lint report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: lint-report | |
| path: app/build/reports/lint-results*.* | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Common setup | |
| uses: ./.github/actions/common-setup | |
| - name: unit tests | |
| run: bash ./gradlew testDebugUnitTest --stacktrace | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results | |
| path: app/build/reports/tests | |
| coverage: | |
| runs-on: ubuntu-24.04 | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Common setup | |
| uses: ./.github/actions/common-setup | |
| - name: coverage | |
| run: bash ./gradlew jacocoTestCoverageVerification --stacktrace | |
| - name: Upload JaCoCo report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: jacoco-report | |
| path: app/build/reports/jacoco | |
| - name: upload coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml | |
| build-apk: | |
| runs-on: ubuntu-24.04 | |
| needs: [ktlint, lint, test, coverage] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Common setup | |
| uses: ./.github/actions/common-setup | |
| - name: build apk | |
| run: bash ./gradlew assembleDebug --stacktrace | |
| - name: artifact apk | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: artifact-apk | |
| path: app/build/outputs/apk/debug | |
| emulator-test: | |
| runs-on: ubuntu-latest | |
| needs: [build-apk] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api-level: [35] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/common-setup | |
| - name: Enable KVM | |
| 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: Gradle cache | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: AVD cache | |
| uses: actions/cache@v5 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-${{ matrix.api-level }} | |
| - name: Create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: ./.github/actions/emulator-step | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| emulator-options: > | |
| -no-window | |
| -no-boot-anim | |
| -gpu swiftshader_indirect | |
| -noaudio | |
| -camera-back none | |
| -camera-front none | |
| disable-animations: true | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Build app and test APKs | |
| run: ./gradlew assembleDebug assembleDebugAndroidTest | |
| - name: Run instrumented tests | |
| uses: ./.github/actions/emulator-step | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| emulator-options: > | |
| -no-window | |
| -no-boot-anim | |
| -gpu swiftshader_indirect | |
| -noaudio | |
| -camera-back none | |
| -camera-front none | |
| disable-animations: true | |
| script: | | |
| adb wait-for-device | |
| # Wait until Android system UI is fully ready | |
| until adb shell getprop sys.boot_completed | grep -m 1 "1"; do sleep 2; done | |
| adb shell settings put global window_animation_scale 0 | |
| adb shell settings put global transition_animation_scale 0 | |
| adb shell settings put global animator_duration_scale 0 | |
| ./gradlew connectedDebugAndroidTest -x assembleDebug -x assembleDebugAndroidTest | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: emulator-test-results-${{ matrix.api-level }} | |
| path: app/build/reports/androidTests | |
| - name: Publish test results | |
| uses: mikepenz/action-junit-report@v6 | |
| if: always() | |
| with: | |
| report_paths: 'app/build/outputs/androidTest-results/connected/**/*.xml' |