Files
TapTap 4be502bb4e
CI / chart (push) Successful in 3s
CI / test (push) Successful in 2m2s
CI / chart-push (push) Successful in 4s
CI / image (push) Successful in 3m13s
fix: harden scans, downloads, sync and radio edge cases
Scanner and library:
- Keep the last library when a configured folder cannot be walked; the
  previous code deleted every song, cascading away mood seeds and progress.
- Re-adding a file now clears its tombstone, and a re-deletion refreshes the
  timestamp instead of keeping the old one.
- Tombstone timestamps are unique per row, and delta pages continue from the
  older of the song/tombstone page ends.
- Snapshot pagination accepts a stable revision for later pages so songs
  inserted mid-sync are not skipped forever.
- Reject "%" and "_" searches that normalize to an empty LIKE needle.

Downloads and discovery:
- Download promotion uses the deterministic path id, one folder per track so
  covers do not overwrite each other, removes failed promotions, and restarts
  the scan after a running one finishes.
- Stale downloading jobs are recovered; reject cancels queued/in-flight jobs;
  markDone only owns downloading rows; rejecting no longer seeds the track.
- Reuse an already completed download of the same video for another mood.
- yt-dlp stdout and stderr are separated, empty discovery results no longer
  prune undecided recommendations, and filenames are capped by UTF-8 bytes.

API and data:
- Malformed or missing JSON returns 400 instead of 500; optional session
  bodies use receiveNullable.
- Playback events must belong to the session, known song and open session.
- Radio refills the candidate pool after recent-song pruning.
- Seed percent is required in MoodRepository.update.
- Normalize legacy V4 liked/downloaded recommendation states before V5, with
  an upgrade regression test.

CI: check out without persisting credentials and require tests before chart
publishing.
2026-11-15 18:18:21 +00:00

119 lines
3.4 KiB
YAML

name: CI
on:
workflow_dispatch:
push:
branches:
- main
tags:
- "v*"
pull_request:
env:
REGISTRY: gitea.tap-tap.win
IMAGE_NAME: taptap/audiomanager
# Built by scripts/build-ci-image.sh from ci/Dockerfile. Bump the tag when
# ci/Dockerfile changes.
CI_IMAGE: gitea.tap-tap.win/taptap/audiomanager-ci:2
jobs:
test:
runs-on: ubuntu-latest
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Test
run: gradle test --console=plain
- name: Smoke test
run: GRADLE=gradle ./scripts/smoke.sh
chart:
runs-on: ubuntu-latest
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Lint and render the chart
run: scripts/check-chart.sh
chart-push:
needs:
- test
- chart
if: github.event_name == 'push'
runs-on: ubuntu-latest
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
permissions:
contents: read
env:
CHARTS_TOKEN: ${{ secrets.AUDIOMANAGER_CHARTS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Package and publish the chart
run: scripts/push-chart.sh
image:
needs:
- test
- chart
if: github.event_name == 'push'
runs-on: ubuntu-latest
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
permissions:
contents: read
packages: write
env:
# A multi-stage build replaces / with the last stage's root filesystem,
# which deletes $HOME/.docker/config.json. Kaniko then has no credentials
# left for the push and gets an anonymous registry token (Gitea reports
# this as "401 reqPackageAccess"). /kaniko is preserved by kaniko, so
# keep the Docker credential store there for the whole job.
DOCKER_CONFIG: /kaniko/.docker
steps:
# No JavaScript actions in this job: kaniko unpacks the final stage's
# root filesystem over /, which removes the tools those actions need for
# their post steps (for example node from the CI image).
- name: Check out the source
run: |
set -euo pipefail
git init -q .
git remote add origin "$GITHUB_SERVER_URL/TapTap/AudioManager.git"
git fetch -q --depth=1 origin "$GITHUB_REF"
git checkout -q FETCH_HEAD
- name: Log in to the registry
run: |
mkdir -p "$DOCKER_CONFIG"
echo "${{ secrets.AUDIOMANAGER_REGISTRY_TOKEN }}" \
| docker login "$REGISTRY" \
--username "${{ gitea.actor }}" \
--password-stdin
- name: Build and push
run: |
set -euo pipefail
tags=("$REGISTRY/$IMAGE_NAME:sha-${GITHUB_SHA::7}")
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
tags+=("$REGISTRY/$IMAGE_NAME:${GITHUB_REF_NAME}")
else
tags+=("$REGISTRY/$IMAGE_NAME:latest")
fi
destinations=()
for tag in "${tags[@]}"; do
destinations+=(--destination "$tag")
done
kaniko-executor \
--context="dir://$PWD" \
--dockerfile="$PWD/Dockerfile" \
--snapshot-mode=redo \
"${destinations[@]}"