Browse Source

CI: Add Android build steps.

Miku AuahDark 1 year ago
parent
commit
60d4de1a6c
1 changed files with 73 additions and 0 deletions
  1. 73 0
      .github/workflows/main.yml

+ 73 - 0
.github/workflows/main.yml

@@ -482,3 +482,76 @@ jobs:
     - name: Build
     - name: Build
       run:
       run:
         xcodebuild -project platform/xcode/love.xcodeproj -scheme love-ios -configuration Release -destination 'platform=iOS Simulator,name=iPhone 11'
         xcodebuild -project platform/xcode/love.xcodeproj -scheme love-ios -configuration Release -destination 'platform=iOS Simulator,name=iPhone 11'
+  Android:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        build_type: [Debug, Release]
+    env:
+      JAVA_OPTS: '-Xmx10G'
+    steps:
+    - name: Prepare Environment
+      run: sudo apt-get update && curl -Lfo kitware-archive.sh https://apt.kitware.com/kitware-archive.sh && sudo bash ./kitware-archive.sh
+    - name: Install Dependencies
+      run: sudo apt-get install ninja-build cmake
+    - name: Checkout love-android
+      uses: actions/checkout@v4
+      with:
+        repository: love2d/love-android
+        submodules: false
+    - name: Setup Java 17
+      uses: actions/setup-java@v4
+      with:
+        distribution: adopt-hotspot
+        java-version: 17
+        cache: gradle
+    - name: Clone Megasource
+      uses: actions/checkout@v4
+      with:
+        path: app/src/main/cpp/megasource
+        repository: love2d/megasource
+        ref: main
+    - name: Checkout
+      uses: actions/checkout@v4
+      with:
+        path: app/src/main/cpp/love
+    - name: Build Normal Flavor
+      run: bash ./gradlew assembleNormalRecord${{ matrix.build_type }}
+    - name: Build Release-specific Binaries
+      if: ${{ matrix.build_type == 'Release' }}
+      run: bash ./gradlew bundleNormalNoRecordRelease bundleEmbedRecordRelease bundleEmbedNoRecordRelease
+    - name: Artifact (Normal debug APK)
+      if: ${{ matrix.build_type == 'Debug' }}
+      uses: actions/upload-artifact@v4
+      with:
+        name: love-android-debug.apk
+        path: app/build/outputs/apk/normalRecord/debug/app-normal-record-debug.apk
+    - name: Artifact (Normal unsigned APK)
+      if: ${{ matrix.build_type == 'Release' }}
+      uses: actions/upload-artifact@v4
+      with:
+        name: love-android.apk
+        path: app/build/outputs/apk/normalRecord/release/app-normal-record-release-unsigned.apk
+    - name: Artifact (Normal AAB w/o recording)
+      if: ${{ matrix.build_type == 'Release' }}
+      uses: actions/upload-artifact@v4
+      with:
+        name: love-android-ps.aab
+        path: app/build/outputs/bundle/normalNoRecordRelease/app-normal-noRecord-release.aab
+    - name: Artifact (Embed AAB)
+      if: ${{ matrix.build_type == 'Release' }}
+      uses: actions/upload-artifact@v4
+      with:
+        name: love-android-embed-record.aab
+        path: app/build/outputs/bundle/embedRecordRelease/app-embed-record-release.aab
+    - name: Artifact (Embed AAB w/o recording)
+      if: ${{ matrix.build_type == 'Release' }}
+      uses: actions/upload-artifact@v4
+      with:
+        name: love-android-embed.aab
+        path: app/build/outputs/bundle/embedNoRecordRelease/app-embed-noRecord-release.aab
+    - name: Artifact (Debug symbols)
+      uses: actions/upload-artifact@v4
+      with:
+        name: love-android-unstripped-debugsyms-${{ matrix.build_type }}
+        path: app/build/intermediates/cxx