Skip to content

Commit

Permalink
Add build workflow and update gradle files
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchieMeng committed Feb 29, 2024
1 parent 440d3b4 commit d7f4a51
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ lint/tmp/

# Android Profiling
*.hprof

# ignore ncnn repo in jni path
app/src/main/jni/ncnn
14 changes: 6 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
}

Expand Down

0 comments on commit d7f4a51

Please sign in to comment.