diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bc622dc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Android CI + +on: + push: + branches: [ "core" ] + pull_request: + branches: [ "core" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: get ncnn repo + run: git clone --recursive https://github.com/Tencent/ncnn app/src/main/jni/ncnn + - name: set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'zulu' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - name: Build debug apk + run: bash ./gradlew assembleDebug --stacktrace + diff --git a/.gitignore b/.gitignore index 5d18272..e367ec9 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,6 @@ lint/tmp/ # Android Profiling *.hprof + +# ignore ncnn repo in jni path +app/src/main/jni/ncnn diff --git a/app/build.gradle b/app/build.gradle index c24b850..e1a1625 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,20 +3,18 @@ apply plugin: 'kotlin-android' ext.getVersionCode = { base -> try { - def stdout = new ByteArrayOutputStream() - exec { + providers.exec { commandLine 'git', 'rev-list', '--count', base + '..HEAD' - standardOutput(stdout) - } - Integer.parseInt(stdout.toString().trim()) + }.standardOutput.asText.get().toInteger() } catch(ignored) { 10 } } android { - compileSdkVersion 30 - ndkVersion '21.4.7075529' + namespace 'pro.archiemeng.waifu2x' + compileSdkVersion 34 + ndkVersion '25.1.8937393' defaultConfig { applicationId "pro.archiemeng.waifu2x" @@ -30,7 +28,7 @@ android { // Change here to choose the type of ncnn integration externalNativeBuild { cmake { - arguments "-DUSE_PREBUILT_NCNN=ON", "-DUSE_SHARED_NCNN=OFF" + arguments "-DUSE_PREBUILT_NCNN=OFF", "-DUSE_SHARED_NCNN=OFF", "-DNCNN_VULKAN=ON" } }