diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..b8c35ca --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,77 @@ +name: Build Android APK + +on: + push: + branches: + - main + - master + - develop + pull_request: + branches: + - main + - master + +jobs: + build: + name: Build APK + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build Debug APK + run: ./gradlew assembleDebug --stacktrace + + - name: Build Release APK (unsigned) + run: ./gradlew assembleRelease --stacktrace + continue-on-error: true + + - name: Upload Debug APK + uses: actions/upload-artifact@v3 + with: + name: app-debug + path: app/build/outputs/apk/debug/app-debug.apk + retention-days: 30 + + - name: Upload Release APK + uses: actions/upload-artifact@v3 + if: success() + with: + name: app-release-unsigned + path: app/build/outputs/apk/release/app-release-unsigned.apk + retention-days: 30 + + - name: Build Summary + if: always() + run: | + echo "### Build Summary 📱" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY + echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY + echo "**Author:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "#### APK Files" >> $GITHUB_STEP_SUMMARY + if [ -f app/build/outputs/apk/debug/app-debug.apk ]; then + SIZE=$(du -h app/build/outputs/apk/debug/app-debug.apk | cut -f1) + echo "- ✅ Debug APK: $SIZE" >> $GITHUB_STEP_SUMMARY + else + echo "- ❌ Debug APK: Failed" >> $GITHUB_STEP_SUMMARY + fi + if [ -f app/build/outputs/apk/release/app-release-unsigned.apk ]; then + SIZE=$(du -h app/build/outputs/apk/release/app-release-unsigned.apk | cut -f1) + echo "- ✅ Release APK: $SIZE" >> $GITHUB_STEP_SUMMARY + else + echo "- ⚠️ Release APK: Not built (needs signing)" >> $GITHUB_STEP_SUMMARY + fi + diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml new file mode 100644 index 0000000..8232d17 --- /dev/null +++ b/.gitea/workflows/ci-cd.yml @@ -0,0 +1,146 @@ +name: CI/CD Pipeline + +on: + push: + branches: + - '**' + pull_request: + branches: + - main + - master + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run Unit Tests + run: ./gradlew test --stacktrace + + - name: Run Lint + run: ./gradlew lint --stacktrace + continue-on-error: true + + - name: Upload Test Reports + uses: actions/upload-artifact@v3 + if: always() + with: + name: test-reports + path: app/build/reports/tests/ + retention-days: 7 + + - name: Upload Lint Reports + uses: actions/upload-artifact@v3 + if: always() + with: + name: lint-reports + path: app/build/reports/lint-results-*.html + retention-days: 7 + + build: + name: Build APK + needs: test + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Get version info + id: version + run: | + VERSION_NAME=$(grep "versionName" app/build.gradle.kts | cut -d '"' -f 2) + VERSION_CODE=$(grep "versionCode" app/build.gradle.kts | grep -o '[0-9]\+') + echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT + echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_OUTPUT + + - name: Build Debug APK + run: ./gradlew assembleDebug --stacktrace + + - name: Build Release APK + run: ./gradlew assembleRelease --stacktrace + continue-on-error: true + + - name: Rename APKs + run: | + if [ -f app/build/outputs/apk/debug/app-debug.apk ]; then + mv app/build/outputs/apk/debug/app-debug.apk \ + app/build/outputs/apk/debug/iTartanas-${{ steps.version.outputs.VERSION_NAME }}-debug.apk + fi + if [ -f app/build/outputs/apk/release/app-release-unsigned.apk ]; then + mv app/build/outputs/apk/release/app-release-unsigned.apk \ + app/build/outputs/apk/release/iTartanas-${{ steps.version.outputs.VERSION_NAME }}-release-unsigned.apk + fi + + - name: Upload Debug APK + uses: actions/upload-artifact@v3 + with: + name: iTartanas-${{ steps.version.outputs.VERSION_NAME }}-debug + path: app/build/outputs/apk/debug/*.apk + retention-days: 30 + + - name: Upload Release APK + uses: actions/upload-artifact@v3 + if: success() + with: + name: iTartanas-${{ steps.version.outputs.VERSION_NAME }}-release + path: app/build/outputs/apk/release/*.apk + retention-days: 30 + + - name: Build Summary + if: always() + run: | + echo "### 📱 iTartanas Build v${{ steps.version.outputs.VERSION_NAME }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY + echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY + echo "**Author:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY + echo "**Version:** ${{ steps.version.outputs.VERSION_NAME }} (Build ${{ steps.version.outputs.VERSION_CODE }})" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "#### 📦 APK Files" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + if [ -f app/build/outputs/apk/debug/iTartanas-*.apk ]; then + SIZE=$(du -h app/build/outputs/apk/debug/iTartanas-*.apk | cut -f1) + echo "| Type | Status | Size |" >> $GITHUB_STEP_SUMMARY + echo "|------|--------|------|" >> $GITHUB_STEP_SUMMARY + echo "| Debug | ✅ Success | $SIZE |" >> $GITHUB_STEP_SUMMARY + else + echo "| Debug | ❌ Failed | - |" >> $GITHUB_STEP_SUMMARY + fi + if [ -f app/build/outputs/apk/release/iTartanas-*.apk ]; then + SIZE=$(du -h app/build/outputs/apk/release/iTartanas-*.apk | cut -f1) + echo "| Release | ✅ Success | $SIZE |" >> $GITHUB_STEP_SUMMARY + else + echo "| Release | ⚠️ Unsigned | - |" >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY + echo "#### 📊 Gradle Build Info" >> $GITHUB_STEP_SUMMARY + echo "\`\`\`" >> $GITHUB_STEP_SUMMARY + ./gradlew --version >> $GITHUB_STEP_SUMMARY + echo "\`\`\`" >> $GITHUB_STEP_SUMMARY + diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..b4d7b6e --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,90 @@ +name: Release APK + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Extract version from tag + id: version + run: | + TAG=${GITHUB_REF#refs/tags/} + VERSION=${TAG#v} + echo "TAG=$TAG" >> $GITHUB_OUTPUT + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + + - name: Build Release APK + run: ./gradlew assembleRelease --stacktrace + + - name: Rename APK + run: | + mv app/build/outputs/apk/release/app-release-unsigned.apk \ + app/build/outputs/apk/release/iTartanas-${{ steps.version.outputs.VERSION }}-release.apk + + - name: Generate Changelog + id: changelog + run: | + echo "CHANGELOG<> $GITHUB_OUTPUT + git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty=format:"- %s" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.version.outputs.TAG }} + release_name: iTartanas ${{ steps.version.outputs.VERSION }} + body: | + # 🎉 iTartanas ${{ steps.version.outputs.VERSION }} + + ## 📱 Descarga + + APK de release sin firmar (para desarrollo/testing) + + ## 📝 Cambios + + ${{ steps.changelog.outputs.CHANGELOG }} + + ## 📊 Información + + - **Versión**: ${{ steps.version.outputs.VERSION }} + - **Commit**: ${{ github.sha }} + - **Fecha**: ${{ github.event.head_commit.timestamp }} + + ## 🔒 Nota de Seguridad + + Este APK no está firmado. Para producción, deberás firmarlo con tu keystore. + draft: false + prerelease: false + + - name: Upload Release APK + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/apk/release/iTartanas-${{ steps.version.outputs.VERSION }}-release.apk + asset_name: iTartanas-${{ steps.version.outputs.VERSION }}-release.apk + asset_content_type: application/vnd.android.package-archive + diff --git a/.gitignore b/.gitignore index c41bb58..ef26f43 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,32 @@ .cxx local.properties /itranvias_code/ + +# Android Studio +*.swp +*~ +.idea/ + +# Gradle +.gradle/ +build/ +*/build/ + +# NDK +obj/ + +# APKs (excepto en releases) +*.apk +*.ap_ +*.aab + +# Keystore files +*.jks +*.keystore + +# Logs +*.log + +# OS +Thumbs.db +