diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f27e18..f57b3ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,8 @@ on: pull_request: jobs: - build: + test: + name: Unit Tests & Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -17,9 +18,96 @@ jobs: - uses: android-actions/setup-android@v3 with: packages: 'platforms;android-35 build-tools;35.0.0' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Run unit tests - run: | - chmod +x gradlew - ./gradlew testDebugUnitTest + run: ./gradlew testDebugUnitTest + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: unit-test-results + path: app/build/test-results/testDebugUnitTest/*.xml + retention-days: 14 + + - name: Run lint + run: ./gradlew lintDebug + + - name: Upload lint results + if: always() + uses: actions/upload-artifact@v4 + with: + name: lint-results + path: app/build/reports/lint-results-debug.* + retention-days: 14 + + build-debug: + name: Debug APK + runs-on: ubuntu-latest + needs: test + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - uses: android-actions/setup-android@v3 + with: + packages: 'platforms;android-35 build-tools;35.0.0' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Assemble Debug - run: ./gradlew assembleDebug \ No newline at end of file + run: ./gradlew assembleDebug + + - name: Upload Debug APK + uses: actions/upload-artifact@v4 + with: + name: debug-apk + path: app/build/outputs/apk/debug/app-debug.apk + retention-days: 14 + + build-release: + name: Release APK (no signing) + runs-on: ubuntu-latest + needs: test + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - uses: android-actions/setup-android@v3 + with: + packages: 'platforms;android-35 build-tools;35.0.0' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Assemble Release + run: ./gradlew assembleRelease + + - name: Verify Release APK + run: | + APK=app/build/outputs/apk/release/app-release.apk + if [ ! -f "$APK" ]; then + echo "❌ Release APK not found" + exit 1 + fi + echo "✅ Release APK size: $(du -h "$APK" | cut -f1)" + # Verify APK contains essential resources + unzip -l "$APK" | grep -q "AndroidManifest.xml" || { echo "❌ AndroidManifest.xml missing"; exit 1; } + unzip -l "$APK" | grep -q "resources.arsc" || { echo "❌ resources.arsc missing"; exit 1; } + unzip -l "$APK" | grep -q "res/" || { echo "❌ res/ directory missing"; exit 1; } + echo "✅ APK integrity verified: manifest + arsc + res/ all present" + + - name: Upload Release APK + uses: actions/upload-artifact@v4 + with: + name: release-apk + path: app/build/outputs/apk/release/app-release.apk + retention-days: 14 \ No newline at end of file