diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..7cc6f9d --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,101 @@ +name: RN APK Build + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + env: + ANDROID_SDK_ROOT: ${{ runner.temp }}/android-sdk + + steps: + # 1. Checkout code + - name: Checkout + uses: actions/checkout@v4 + + # 2. Node setup + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + # 3. Install JS deps + - name: Install dependencies + run: npm install + + # 4. Java setup + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + # 5. Gradle cache + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle- + + # 6. Maven cache + - name: Cache Maven + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: maven-${{ hashFiles('**/*.gradle*') }} + restore-keys: maven- + + # 7. Android SDK setup + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + with: + accept-android-sdk-licenses: true + + # 8. Install SDK components + - name: Install SDK Components + run: | + sdkmanager \ + "platform-tools" \ + "platforms;android-36" \ + "build-tools;36.0.0" \ + "ndk;27.1.12297006" \ + "cmake;3.22.1" + + # 9. Gradlew permission + - name: Make Gradlew executable + run: chmod +x android/gradlew + + # 10. Clean build (safe) + - name: Clean project + run: cd android && ./gradlew clean + + # 11. Build APK + - name: Build Release APK + run: | + cd android + ./gradlew assembleRelease \ + --no-daemon \ + --stacktrace \ + -Dorg.gradle.jvmargs="-Xmx4g -Dfile.encoding=UTF-8" \ + -Dorg.gradle.daemon=false \ + -Pandroid.ndkVersion=27.1.12297006 \ + -Pandroid.ndkPath=$ANDROID_SDK_ROOT/ndk/27.1.12297006 + + # 12. Verify APK + - name: Show APK + run: find android/app/build/outputs/apk -name "*.apk" + + # 13. Upload APK artifact + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: app-release + path: android/app/build/outputs/apk/release/app-release.apk \ No newline at end of file