3 Commits
Author SHA1 Message Date
TapTap 8d7f6a0ccb fix: re-run search immediately when the mood source changes
CI / build (push) Successful in 3m54s
CI / play (push) Successful in 3m29s
The explicit source switch cancelled the debounced search and then waited
another 300 ms for no reason. It now searches right away, which also makes the
test deterministic.
2026-11-18 19:48:09 +00:00
TapTap 4048262fc5 feat: remove the Up next preview section
CI / build (push) Successful in 2m22s
CI / play (push) Skipped
The preview duplicated what the radio does and is not the real queue. Mood
detail now only loads songs and recommendations, so opening a mood makes one
fewer request.

Also drop the Wasm warm-up from the CI image recipe: the target is local-only.
Version 0.3.3.
2026-11-18 19:39:51 +00:00
TapTap 14e5b9d982 ci: drop the Wasm build from the pipeline
CI / build (push) Successful in 2m57s
CI / play (push) Skipped
It is CPU-bound and dominates the runtime. The target stays available for
local builds with :composeApp:wasmJsBrowserDistribution.
2026-11-18 19:26:04 +00:00
9 changed files with 29 additions and 60 deletions

No files matched your search

+2 -5
View File
@@ -45,15 +45,13 @@ jobs:
:composeApp:desktopTest \ :composeApp:desktopTest \
:composeApp:assembleDebug \ :composeApp:assembleDebug \
:composeApp:packageUberJarForCurrentOS \ :composeApp:packageUberJarForCurrentOS \
:composeApp:wasmJsBrowserDistribution \
--console=plain --console=plain
else else
# The optimized Wasm build is CPU-bound and slow; main/PR builds # The Wasm target is kept for local builds but is not part of CI:
# only need to prove the web target compiles and bundles. # it is CPU-bound and dominates the pipeline runtime.
gradle \ gradle \
:composeApp:desktopTest \ :composeApp:desktopTest \
:composeApp:assembleDebug \ :composeApp:assembleDebug \
:composeApp:wasmJsBrowserDevelopmentExecutableDistribution \
--console=plain --console=plain
fi fi
@@ -64,7 +62,6 @@ jobs:
cp composeApp/build/outputs/apk/debug/composeApp-debug.apk dist/AudioManager.apk cp composeApp/build/outputs/apk/debug/composeApp-debug.apk dist/AudioManager.apk
if [[ "$GITHUB_REF" == refs/tags/* ]]; then if [[ "$GITHUB_REF" == refs/tags/* ]]; then
cp composeApp/build/compose/jars/*.jar dist/AudioManager-desktop.jar cp composeApp/build/compose/jars/*.jar dist/AudioManager-desktop.jar
(cd composeApp/build/dist/wasmJs/productionExecutable && zip -qr "$GITHUB_WORKSPACE/dist/AudioManager-web.zip" .)
fi fi
- name: Publish release assets - name: Publish release assets
+7 -7
View File
@@ -133,7 +133,7 @@ gradle :composeApp:run
# Desktop fat jar # Desktop fat jar
gradle :composeApp:packageUberJarForCurrentOS gradle :composeApp:packageUberJarForCurrentOS
# Web bundle # Web bundle (local only, not built by CI)
gradle :composeApp:wasmJsBrowserDistribution gradle :composeApp:wasmJsBrowserDistribution
# composeApp/build/dist/wasmJs/productionExecutable # composeApp/build/dist/wasmJs/productionExecutable
``` ```
@@ -200,7 +200,7 @@ Tagged builds (`v*`) publish to internal testing from CI. The Gitea secrets are:
| `ANDROID_KEY_PASSWORD` | key password | | `ANDROID_KEY_PASSWORD` | key password |
| `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON | | `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON |
Then `git tag v0.3.2 && git push --tags` builds, signs and uploads the bundle. Then `git tag v0.3.3 && git push --tags` builds, signs and uploads the bundle.
Gradle Play Publisher asks Play for the next free `versionCode` Gradle Play Publisher asks Play for the next free `versionCode`
(`ResolutionStrategy.AUTO`), so only the tag/version name needs to change. (`ResolutionStrategy.AUTO`), so only the tag/version name needs to change.
@@ -250,11 +250,11 @@ radio and visible in the song list.
`gitea.tap-tap.win/taptap/audiomanager-client-ci:3`. The image has the Android `gitea.tap-tap.win/taptap/audiomanager-client-ci:3`. The image has the Android
SDK, Node, Yarn and a warmed Gradle dependency cache. SDK, Node, Yarn and a warmed Gradle dependency cache.
- **main / PR:** run `desktopTest`, build the Android APK and the *development* - **main / PR:** run `desktopTest` and build the Android APK.
Wasm bundle. - **`v*` tag:** additionally build the desktop fat jar, attach the artifacts to
- **`v*` tag:** additionally build the desktop fat jar and the optimized Wasm the Gitea release, and publish the AAB to Play internal testing.
bundle, attach the artifacts to the Gitea release, and publish the AAB to Play - The Wasm target stays in the project for local builds but is **not** part of
internal testing. CI; compiling it dominates the pipeline runtime.
Rebuild the CI image after changing `ci/Dockerfile` or dependency versions: Rebuild the CI image after changing `ci/Dockerfile` or dependency versions:
+4 -9
View File
@@ -43,21 +43,16 @@ RUN mkdir -p "$ANDROID_HOME/cmdline-tools" \
"build-tools;36.0.0" \ "build-tools;36.0.0" \
&& rm -rf "$ANDROID_HOME/.temp" "$ANDROID_HOME/.downloadIntermediates" && rm -rf "$ANDROID_HOME/.temp" "$ANDROID_HOME/.downloadIntermediates"
# Warm the Gradle dependency cache and the Kotlin/Wasm (node, yarn, binaryen) # Warm the Gradle dependency cache and the common/Android/desktop compilers so
# toolchain so CI jobs do not download them on every run. Rebuild this image # CI jobs do not download them on every run. The Wasm toolchain is intentionally
# when dependencies change. # not warmed: Wasm is not part of the pipeline. Rebuild this image when
# dependencies change.
COPY . /warmup COPY . /warmup
WORKDIR /warmup WORKDIR /warmup
# Warm dependencies and the common/Android/desktop compilers here. The Wasm
# executable build is memory hungry and stays in the web job, but node and yarn
# are cached: Kotlin downloads them from GitHub, which has been flaky during CI.
RUN sed -i 's/kotlin.daemon.jvmargs=-Xmx3g/kotlin.daemon.jvmargs=-Xmx2g/' gradle.properties \ RUN sed -i 's/kotlin.daemon.jvmargs=-Xmx3g/kotlin.daemon.jvmargs=-Xmx2g/' gradle.properties \
&& gradle --no-daemon --max-workers=2 \ && gradle --no-daemon --max-workers=2 \
:kotlinNodeJsSetup \
:kotlinYarnSetup \
:composeApp:desktopTest \ :composeApp:desktopTest \
:composeApp:assembleDebug \ :composeApp:assembleDebug \
:composeApp:compileKotlinWasmJs \
--console=plain \ --console=plain \
&& rm -rf /warmup && rm -rf /warmup
+1 -1
View File
@@ -41,7 +41,7 @@ val hasUploadKey = uploadKeyStore?.exists() == true &&
val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt() val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt()
val appVersionName = System.getenv("VERSION_NAME") val appVersionName = System.getenv("VERSION_NAME")
?: localProperties.getProperty("VERSION_NAME") ?: localProperties.getProperty("VERSION_NAME")
?: "0.3.2" ?: "0.3.3"
kotlin { kotlin {
androidTarget { androidTarget {
@@ -184,9 +184,6 @@ class ApiClient(private val http: HttpClient) {
}, },
) )
suspend fun preview(moodId: String, limit: Int = 20): List<Song> =
get<TracksResponse>("/moods/$moodId/preview?limit=$limit").songs
suspend fun search( suspend fun search(
query: String, query: String,
limit: Int = 10, limit: Int = 10,
@@ -45,7 +45,6 @@ data class AppState(
val screen: Screen = Screen.Moods, val screen: Screen = Screen.Moods,
val moods: List<Mood> = emptyList(), val moods: List<Mood> = emptyList(),
val selectedMood: MoodDetail? = null, val selectedMood: MoodDetail? = null,
val preview: List<Song> = emptyList(),
val session: Session? = null, val session: Session? = null,
val queue: List<Song> = emptyList(), val queue: List<Song> = emptyList(),
val current: Song? = null, val current: Song? = null,
@@ -282,23 +281,19 @@ class AppStore(
loading = true, loading = true,
screen = Screen.MoodDetail, screen = Screen.MoodDetail,
selectedMood = null, selectedMood = null,
preview = emptyList(),
) )
} }
try { try {
val detail = api.mood(id) val detail = api.mood(id)
val preview = runCatching { api.preview(id, 20) }.getOrDefault(emptyList())
if (request != moodRequestGeneration) return@launch if (request != moodRequestGeneration) return@launch
cacheDetail(detail) cacheDetail(detail)
_state.update { _state.update {
it.copy( it.copy(
loading = false, loading = false,
selectedMood = detail, selectedMood = detail,
preview = preview,
knownSongs = it.knownSongs + detail.songMap(), knownSongs = it.knownSongs + detail.songMap(),
) )
} }
mergeSongs(preview)
} catch (t: Throwable) { } catch (t: Throwable) {
if (request != moodRequestGeneration) return@launch if (request != moodRequestGeneration) return@launch
val cached = cache.load().moodDetails.firstOrNull { it.mood.id == id } val cached = cache.load().moodDetails.firstOrNull { it.mood.id == id }
@@ -307,7 +302,6 @@ class AppStore(
loading = false, loading = false,
// Never leave a different mood editable under the new title. // Never leave a different mood editable under the new title.
selectedMood = cached, selectedMood = cached,
preview = emptyList(),
knownSongs = it.knownSongs + (cached?.songMap() ?: emptyMap()), knownSongs = it.knownSongs + (cached?.songMap() ?: emptyMap()),
message = if (cached == null) t.friendlyMessage() else "Showing cached mood", message = if (cached == null) t.friendlyMessage() else "Showing cached mood",
messageIsError = cached == null, messageIsError = cached == null,
@@ -375,13 +369,21 @@ class AppStore(
} }
fun search(query: String) { fun search(query: String) {
runSearch(query, debounce = true)
}
/**
* A source change is explicit, so it re-runs the query immediately instead
* of waiting for the keystroke debounce.
*/
private fun runSearch(query: String, debounce: Boolean) {
searchJob?.cancel() searchJob?.cancel()
if (query.isBlank()) { if (query.isBlank()) {
_state.update { it.copy(searchResults = emptyList(), searching = false) } _state.update { it.copy(searchResults = emptyList(), searching = false) }
return return
} }
searchJob = scope.launch { searchJob = scope.launch {
delay(SEARCH_DEBOUNCE_MS) if (debounce) delay(SEARCH_DEBOUNCE_MS)
_state.update { it.copy(searching = true) } _state.update { it.copy(searching = true) }
try { try {
val target = _state.value.moods.firstOrNull { val target = _state.value.moods.firstOrNull {
@@ -555,7 +557,7 @@ class AppStore(
if (_state.value.searchTargetMoodId == moodId && if (_state.value.searchTargetMoodId == moodId &&
_state.value.searchQuery.isNotBlank() _state.value.searchQuery.isNotBlank()
) { ) {
search(_state.value.searchQuery) runSearch(_state.value.searchQuery, debounce = false)
} }
} catch (t: Throwable) { } catch (t: Throwable) {
message(t) message(t)
@@ -186,25 +186,6 @@ fun MoodDetailScreen(state: AppState, store: AppStore) {
} }
} }
if (state.preview.isNotEmpty()) {
item {
HorizontalDivider(Modifier.padding(vertical = 12.dp))
SectionTitle("Up next")
Text(
"Preview of the radio mix: these are the tracks that would play next. " +
"Nothing here is downloaded or saved.",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(4.dp))
}
items(state.preview, key = { "preview-${it.id}" }) { song ->
SongRow(store, song, onPlay = { store.playSong(song) }) {
Text(formatDuration(song.duration), style = MaterialTheme.typography.labelSmall)
}
}
}
item { item {
HorizontalDivider(Modifier.padding(vertical = 12.dp)) HorizontalDivider(Modifier.padding(vertical = 12.dp))
SectionTitle("Recommendations") { SectionTitle("Recommendations") {
@@ -107,7 +107,7 @@ fun SettingsScreen(state: AppState, store: AppStore) {
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold)
Text( Text(
"AudioManager 0.3.2 · $platformName", "AudioManager 0.3.3 · $platformName",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
) )
@@ -45,7 +45,6 @@ class AppStoreTest {
"/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods" -> respond("""{"moods":[${moodJson(1)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(1)}]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1" -> respond(detailJson(listOf("a")), HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1" -> respond(detailJson(listOf("a")), HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/sessions" -> respond( "/api/v1/moods/mo-1/sessions" -> respond(
"""{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now", """{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now",
"queue":[${songJson("a")}]}""", "queue":[${songJson("a")}]}""",
@@ -82,7 +81,6 @@ class AppStoreTest {
"/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods" -> respond("""{"moods":[${moodJson(0)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(0)}]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1" -> respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1" -> respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
else -> respondError(HttpStatusCode.NotFound) else -> respondError(HttpStatusCode.NotFound)
} }
} }
@@ -205,7 +203,6 @@ class AppStoreTest {
HttpStatusCode.OK, HttpStatusCode.OK,
jsonHeaders, jsonHeaders,
) )
"/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/recommendations/v1/add" -> respond( "/api/v1/moods/mo-1/recommendations/v1/add" -> respond(
"""{"detail":${detailJson(listOf("a"))}, """{"detail":${detailJson(listOf("a"))},
"recommendation":${recommendationJson(state = "added", songId = "a")}}""", "recommendation":${recommendationJson(state = "added", songId = "a")}}""",
@@ -245,8 +242,6 @@ class AppStoreTest {
respond(detailJson(emptyList(), source = "deezer"), HttpStatusCode.OK, jsonHeaders) respond(detailJson(emptyList(), source = "deezer"), HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/moods/mo-1" -> request.url.encodedPath == "/api/v1/moods/mo-1" ->
respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders) respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/moods/mo-1/preview" ->
respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/search" -> { request.url.encodedPath == "/api/v1/search" -> {
val source = request.url.parameters["source"] val source = request.url.parameters["source"]
val body = if (source == "deezer") { val body = if (source == "deezer") {
@@ -271,6 +266,10 @@ class AppStoreTest {
runCurrent() runCurrent()
store.setMoodSource("mo-1", "deezer") store.setMoodSource("mo-1", "deezer")
awaitState("mood source updated") {
store.state.value.moods.first { it.id == "mo-1" }.source == "deezer"
}
// The source change re-runs the search immediately, without debounce.
awaitState { store.state.value.searchResults.any { it.source == "deezer" } } awaitState { store.state.value.searchResults.any { it.source == "deezer" } }
assertEquals("deezer", store.state.value.moods.first { it.id == "mo-1" }.source) assertEquals("deezer", store.state.value.moods.first { it.id == "mo-1" }.source)
@@ -345,7 +344,6 @@ class AppStoreTest {
HttpStatusCode.OK, HttpStatusCode.OK,
jsonHeaders, jsonHeaders,
) )
"/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/sessions" -> respond( "/api/v1/moods/mo-1/sessions" -> respond(
"""{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now", """{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now",
"queue":[${songJson("a")},${songJson("b")},${songJson("c")}]}""", "queue":[${songJson("a")},${songJson("b")},${songJson("c")}]}""",
@@ -384,7 +382,6 @@ class AppStoreTest {
"/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods" -> respond("""{"moods":[${moodJson(3)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(3)}]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1" -> respond(detailJson(listOf("a", "b", "c")), HttpStatusCode.OK, jsonHeaders) "/api/v1/moods/mo-1" -> respond(detailJson(listOf("a", "b", "c")), HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/preview" -> respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods/mo-1/sessions" -> respond( "/api/v1/moods/mo-1/sessions" -> respond(
"""{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now", """{"id":"s1","moodId":"mo-1","moodName":"Focus","startedAt":"now",
"queue":[${songJson("a")},${songJson("b")},${songJson("c")}]}""", "queue":[${songJson("a")},${songJson("b")},${songJson("c")}]}""",