Skip to content

Commit

Permalink
Tested: add android ci
Browse files Browse the repository at this point in the history
  • Loading branch information
wysaid committed May 5, 2024
1 parent a82f76a commit 09182ac
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Android CI

on:
push:
branches: [ "master", "android_ci" ]
pull_request:
branches: [ "master", "android_ci" ]

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: nttld/[email protected]
id: setup-ndk
with:
ndk-version: r26d
link-to-sdk: true
add-to-path: true
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Release Without Video Module
run: ./tasks.sh --enable-cmake --release --disable-video-module --build
- name: Save build artifacts - Release Without Video Module
run: mv $(find "cgeDemo/build" -iname "*.apk" | grep release) demoRelease/cgeDemo_NoVideoRecord.apk
- name: Build Release With Video Module
run: ./tasks.sh --clean --enable-cmake --release --enable-video-module --build
- name: Save build artifacts - Release With Video Module
run: mv $(find "cgeDemo/build" -iname "*.apk" | grep release) demoRelease/cgeDemo.apk
- name: lint
run: ./gradlew lint
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: my-artifact
path: |
demoRelease/cgeDemo_NoVideoRecord.apk
demoRelease/cgeDemo.apk
compression-level: 0
retention-days: 15
if-no-files-found: error
6 changes: 5 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ include ':library', ':cgeDemo'

def pFile = new File(settingsDir, 'local.properties')
Properties properties = new Properties()
properties.load(pFile.newDataInputStream())

/// if the local.properties file does not exist, create it.
if (pFile.exists()) {
properties.load(pFile.newDataInputStream())
}

if (properties.getProperty('usingCMakeCompile', null) == null) {
pFile.append('\nusingCMakeCompile=false\n')
Expand Down
8 changes: 4 additions & 4 deletions tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ while [[ $# > 0 ]]; do
shift
;;
--release)
ANDROID_BUILD_TYPE="assembleRelease"
export ANDROID_BUILD_TYPE="assembleRelease"
# ANDROID_BUILD_TYPE="assembleDebug" # use this if the release apk can not be installed.
GRADLEW_RUN_TASK="installRelease"
export GRADLEW_RUN_TASK="installRelease"
changeProperty "local.properties" '^usingCMakeCompileDebug=' 's/usingCMakeCompileDebug=.*/usingCMakeCompileDebug=false/' 'usingCMakeCompileDebug=false'
shift
;;
--debug)
ANDROID_BUILD_TYPE="assembleDebug"
GRADLEW_RUN_TASK="installDebug"
export ANDROID_BUILD_TYPE="assembleDebug"
export GRADLEW_RUN_TASK="installDebug"
changeProperty "local.properties" '^usingCMakeCompileDebug=' 's/usingCMakeCompileDebug=.*/usingCMakeCompileDebug=true/' 'usingCMakeCompileDebug=true'
shift
;;
Expand Down

0 comments on commit 09182ac

Please sign in to comment.