Repository navigation
update CI emulator test #169
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: | |
| license-header: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: license header check | |
| run: ./scripts/check-license-headers.sh | |
| ktlint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - 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@v7 | |
| - 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@v7 | |
| - 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@v7 | |
| - 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@v7 | |
| 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@v7 | |
| - 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: [31, 33, 35, '37.0'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - 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: Build app and test APKs | |
| run: ./gradlew assembleDebug assembleDebugAndroidTest | |
| - name: Run instrumented tests | |
| uses: ./.github/actions/emulator-step | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| script: | | |
| adb wait-for-device | |
| until adb shell service check package; do | |
| sleep 2 | |
| done | |
| sleep 5 | |
| ./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' |