Skip to content

Commit

Permalink
feat: build apk in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hpp2334 committed Nov 20, 2024
1 parent 9128318 commit 27eb226
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
35 changes: 15 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,35 @@ jobs:
~/.cargo/git/db/
key: ${{ runner.os }}-cargo
restore-keys: ${{ runner.os }}-cargo
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.2"
channel: "stable"
- uses: oven-sh/setup-bun@v2
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
ndk-version: r28-beta2
add-to-path: false
local-cache: true
- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Install scripts runtime
run: pnpm install
run: bun install
- name: Install cargo-ndk
run: |
cargo install --locked cargo-ndk || true
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
- name: Install flutter dependencies
run: flutter pub get
- name: Install flutter rust bridge
run: |
cargo install --locked [email protected] || true
cargo install --locked '[email protected]' || true
- name: Generate codes
run: pnpm run generate
rustup target add aarch64-linux-android
- name: Build JNI
run: bun run build:jni
- name: Run tests
run: pnpm run test
run: bun run test
- name: Build APK
if: ${{ startsWith(github.ref, 'refs/tags/v') }} || ${{ startsWith(github.ref, 'refs/tags/pre-v') }}
run: |
mkdir -p ~/.gradle
echo "ANDROID_NDK=$ANDROID_NDK_HOME" >> ~/.gradle/gradle.properties
pnpm run build:apk
bun run build:apk
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_SIGN_JKS: ${{ secrets.ANDROID_SIGN_JKS }}
Expand Down
3 changes: 2 additions & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
minSdk = 29
targetSdk = 34
versionCode = 1
versionName = "0.2"
versionName = "0.2.0-beta.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -62,6 +62,7 @@ android {
debugSymbolLevel = "SYMBOL_TABLE"
}
}

}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
import androidx.media3.common.PlaybackException
import androidx.media3.common.Player
import androidx.media3.common.Player.COMMAND_SEEK_TO_NEXT
import androidx.media3.common.Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM
import androidx.media3.common.Player.COMMAND_SEEK_TO_PREVIOUS
import androidx.media3.common.Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.extractor.metadata.flac.PictureFrame
Expand Down Expand Up @@ -293,10 +289,13 @@ class PlaybackService : MediaSessionService() {
.build()
val playerCommands =
MediaSession.ConnectionResult.DEFAULT_PLAYER_COMMANDS.buildUpon()
.remove(COMMAND_SEEK_TO_PREVIOUS)
.remove(COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM)
.remove(COMMAND_SEEK_TO_NEXT)
.remove(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)
.remove(Player.COMMAND_SEEK_TO_PREVIOUS)
.remove(Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM)
.remove(Player.COMMAND_SEEK_TO_NEXT)
.remove(Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)
.remove(Player.COMMAND_SEEK_BACK)
.remove(Player.COMMAND_SEEK_FORWARD)
.remove(Player.COMMAND_SEEK_TO_DEFAULT_POSITION)
.build()
// Custom layout and available commands to configure the legacy/framework session.
return MediaSession.ConnectionResult.AcceptedResultBuilder(session)
Expand Down

0 comments on commit 27eb226

Please sign in to comment.