Merge pull request #6 from cango91/renovate/com.ibm.icu-icu4j-77.x #29
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: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: | |
| - 'v*' # Trigger on version tags like v1.0.0 | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| # Set this to 'false' in repository environment variables to disable instrumented tests | |
| RUN_INSTRUMENTED_TESTS: ${{ vars.RUN_INSTRUMENTED_TESTS != 'false' }} | |
| permissions: | |
| contents: write # Required for creating releases and uploading assets | |
| actions: read # Required for accessing workflow artifacts | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run unit tests | |
| run: ./gradlew test --continue | |
| - name: Run lint | |
| run: ./gradlew lint | |
| - name: Build debug APK | |
| run: ./gradlew assembleDebug | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: app/build/reports/tests/ | |
| retention-days: 30 | |
| - name: Upload lint results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: lint-results | |
| path: app/build/reports/lint-results-debug.html | |
| retention-days: 30 | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug-apk | |
| path: app/build/outputs/apk/debug/app-debug.apk | |
| retention-days: 7 | |
| # Matrix instrumented tests for minSdk and targetSdk | |
| instrumented-tests: | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.test.result == 'success' && vars.RUN_INSTRUMENTED_TESTS != 'false' }} | |
| needs: test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api-level: [29, 36] # minSdk and targetSdk | |
| include: | |
| - api-level: 29 | |
| target: default | |
| arch: x86_64 | |
| - api-level: 36 | |
| target: google_apis | |
| arch: x86_64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - 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: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }} | |
| - name: Create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 2048 -no-snapshot-load | |
| disable-animations: true | |
| script: | | |
| echo "Generated AVD snapshot for caching." | |
| adb shell input keyevent 82 | |
| - name: Run instrumented tests | |
| timeout-minutes: 30 | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 2048 | |
| disable-animations: true | |
| script: ./gradlew connectedAndroidTest | |
| - name: Force cleanup emulator processes | |
| if: always() | |
| run: | | |
| pkill -f emulator || true | |
| pkill -f qemu || true | |
| - name: Check coverage report exists | |
| id: coverage-check | |
| run: | | |
| if [ -f "./app/build/reports/coverage/androidTest/debug/connected/report.xml" ]; then | |
| echo "coverage_exists=true" >> $GITHUB_OUTPUT | |
| echo "Coverage report found" | |
| else | |
| echo "coverage_exists=false" >> $GITHUB_OUTPUT | |
| echo "Coverage report not found" | |
| fi | |
| - name: Upload coverage to Codecov | |
| if: steps.coverage-check.outputs.coverage_exists == 'true' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./app/build/reports/coverage/androidTest/debug/connected/report.xml | |
| flags: instrumented-tests | |
| name: codecov-instrumented-${{ matrix.api-level }} | |
| fail_ci_if_error: false | |
| verbose: true | |
| - name: Upload instrumented test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: instrumented-test-results-api-${{ matrix.api-level }} | |
| path: app/build/reports/androidTests/ | |
| retention-days: 30 | |
| # Tag-triggered release job | |
| release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build debug APK for release | |
| run: ./gradlew assembleDebug | |
| - name: Get tag name | |
| id: tag | |
| run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| app/build/outputs/apk/debug/app-debug.apk | |
| name: Release ${{ steps.tag.outputs.tag }} | |
| body: | | |
| Release ${{ steps.tag.outputs.tag }} | |
| ## Installation | |
| Download and install the `app-debug.apk` file below. | |
| **Note**: This is a debug-signed APK for easy installation. Enable "Install unknown apps" for your browser/file manager if needed. | |
| ## What's Changed | |
| - See commit history for detailed changes | |
| draft: false | |
| prerelease: ${{ contains(steps.tag.outputs.tag, 'beta') || contains(steps.tag.outputs.tag, 'alpha') || contains(steps.tag.outputs.tag, 'rc') }} | |
| generate_release_notes: true |