mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-21 05:18:08 +09:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a28c95786 | ||
|
|
48acb6c4e1 | ||
|
|
da60495144 | ||
|
|
e282f40758 | ||
|
|
6da6656c15 | ||
|
|
d81591ca99 | ||
|
|
0e66ac84ec | ||
|
|
d8e3542850 | ||
|
|
8b66e97459 | ||
|
|
8dc0a96734 |
No files matched your search
@@ -418,6 +418,34 @@ jobs:
|
||||
poetry run python -m py_compile backend/main.py backend/config.py
|
||||
echo "✅ Basic syntax validation passed"
|
||||
|
||||
# ============================================
|
||||
# CI GATE - Required status check for PRs
|
||||
# ============================================
|
||||
|
||||
ci-gate:
|
||||
name: "CI Gate"
|
||||
runs-on: ubuntu-latest
|
||||
needs: [frontend-unit-tests, package-unit-tests, package-integration-tests, backend-unit-tests, backend-emulator-tests, backend-lint]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Check results
|
||||
run: |
|
||||
results=(
|
||||
"${{ needs.frontend-unit-tests.result }}"
|
||||
"${{ needs.package-unit-tests.result }}"
|
||||
"${{ needs.package-integration-tests.result }}"
|
||||
"${{ needs.backend-unit-tests.result }}"
|
||||
"${{ needs.backend-emulator-tests.result }}"
|
||||
"${{ needs.backend-lint.result }}"
|
||||
)
|
||||
for result in "${results[@]}"; do
|
||||
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
|
||||
echo "❌ CI failed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "✅ CI passed"
|
||||
|
||||
# ============================================
|
||||
# DEPLOYMENTS (main branch only)
|
||||
# ============================================
|
||||
@@ -514,9 +542,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [frontend-unit-tests]
|
||||
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' && (needs.frontend-unit-tests.result == 'success' || needs.frontend-unit-tests.result == 'skipped') }}
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -18,18 +18,15 @@ Create descriptive branch names like `feature/add-discord-notifications`, `fix/a
|
||||
|
||||
### Using Git Worktrees
|
||||
|
||||
**For non-trivial changes** (new features, multi-file edits, refactors):
|
||||
- Create a git worktree in the parent folder before making any file changes:
|
||||
```bash
|
||||
git worktree add ../karaoke-gen-feat-xyz feature/xyz
|
||||
```
|
||||
**All changes require a git worktree.** Since all changes must go through a PR, always create a worktree in the parent folder before making any file changes:
|
||||
|
||||
```bash
|
||||
git worktree add -b feature/xyz ../karaoke-gen-feat-xyz main
|
||||
```
|
||||
|
||||
- This keeps the main directory clean on `main` and enables parallel work on multiple features
|
||||
- Name the worktree folder descriptively, e.g., `../karaoke-gen-fix-audio-sync`
|
||||
|
||||
**For trivial changes** (typos, single-line fixes):
|
||||
- Creating a branch in the current directory is acceptable
|
||||
- Use `git checkout -b fix/typo-xyz` before making changes
|
||||
|
||||
**Cleanup:** When done with a worktree, remove it with:
|
||||
```bash
|
||||
git worktree remove ../karaoke-gen-feat-xyz
|
||||
@@ -75,11 +72,13 @@ Do not attempt to work around auth issues or make assumptions about credentials.
|
||||
|
||||
## Version Management
|
||||
|
||||
When committing and pushing changes, always bump the patch version in `pyproject.toml`.
|
||||
When committing and pushing **code changes**, bump the patch version in `pyproject.toml`.
|
||||
|
||||
The version is located at `tool.poetry.version` in `pyproject.toml`. For example, if the current version is `0.70.3`, bump it to `0.70.4`.
|
||||
|
||||
This ensures every commit pushed to the repository has a unique version number for tracking and deployment purposes.
|
||||
**Skip version bumps** for documentation-only changes (e.g., updating `CLAUDE.md`, `README.md`, or other markdown files) that don't affect deployed code.
|
||||
|
||||
This ensures every code release has a unique version number for tracking and deployment purposes.
|
||||
|
||||
## Testing Requirements
|
||||
|
||||
@@ -129,3 +128,25 @@ Individual test commands:
|
||||
|
||||
**Do not commit or push code that fails tests. Fix any test failures before proceeding.**
|
||||
|
||||
## Related Projects
|
||||
|
||||
### flacfetch
|
||||
|
||||
**Location:** `/Users/andrew/Projects/flacfetch`
|
||||
|
||||
The `flacfetch` package is a dependency of karaoke-gen that we also own. When working on features that interact with flacfetch, you can read and modify its code directly.
|
||||
|
||||
**Workflow for flacfetch changes:**
|
||||
|
||||
1. Navigate to `/Users/andrew/Projects/flacfetch`
|
||||
2. Make changes directly on `main` (no PR required for this repo)
|
||||
3. Run tests and ensure they pass
|
||||
4. Bump the version in flacfetch's `pyproject.toml`
|
||||
5. Commit and push to `main`
|
||||
6. Wait for CI workflow to complete and auto-release the new version
|
||||
7. Return to karaoke-gen and update the poetry dependency:
|
||||
```bash
|
||||
poetry update flacfetch
|
||||
```
|
||||
8. Commit the updated `poetry.lock` in karaoke-gen
|
||||
|
||||
@@ -1696,7 +1696,7 @@ class RemoteFlacFetchAudioFetcher(AudioFetcher):
|
||||
import re
|
||||
|
||||
self.logger.info(f"[RemoteFlacFetcher] Downloading from URL: {url}")
|
||||
self.logger.info(f"[RemoteFlacFetcher] Using local flacfetch for YouTube download (no remote API needed)")
|
||||
self.logger.info("[RemoteFlacFetcher] Using local flacfetch for YouTube download (no remote API needed)")
|
||||
|
||||
try:
|
||||
# Use local flacfetch for YouTube downloads - no need for remote API
|
||||
@@ -1762,7 +1762,7 @@ class RemoteFlacFetchAudioFetcher(AudioFetcher):
|
||||
except ImportError as e:
|
||||
raise DownloadError(
|
||||
f"flacfetch is required for URL downloads but import failed: {e}"
|
||||
)
|
||||
) from e
|
||||
except Exception as e:
|
||||
raise DownloadError(f"Failed to download from URL {url}: {e}") from e
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ class KaraokePrep:
|
||||
)
|
||||
|
||||
# Update extractor to reflect the source
|
||||
self.extractor = f"youtube"
|
||||
self.extractor = "youtube"
|
||||
else:
|
||||
# Use flacfetch to search and download audio
|
||||
self.logger.info(f"Using flacfetch to search and download: {self.artist} - {self.title}")
|
||||
|
||||
@@ -568,7 +568,7 @@ class TestAsync:
|
||||
basic_karaoke_gen.title = None # Missing title
|
||||
|
||||
# Test that ValueError is raised
|
||||
with pytest.raises(ValueError, match="Either a local file path.*or both artist and title must be provided"):
|
||||
with pytest.raises(ValueError, match=r"Either a local file path.*or both artist and title must be provided"):
|
||||
await basic_karaoke_gen.process()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -610,7 +610,10 @@ class TestAsync:
|
||||
with patch.object(basic_karaoke_gen, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
|
||||
mock_prep_single_track.return_value = {"track": "result"}
|
||||
|
||||
result = await basic_karaoke_gen.process()
|
||||
await basic_karaoke_gen.process()
|
||||
|
||||
# Verify prep_single_track was called
|
||||
mock_prep_single_track.assert_called_once()
|
||||
|
||||
# Verify URL mode was enabled
|
||||
assert basic_karaoke_gen._use_audio_fetcher is True
|
||||
@@ -631,7 +634,10 @@ class TestAsync:
|
||||
with patch.object(basic_karaoke_gen, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
|
||||
mock_prep_single_track.return_value = {"track": "result"}
|
||||
|
||||
result = await basic_karaoke_gen.process()
|
||||
await basic_karaoke_gen.process()
|
||||
|
||||
# Verify prep_single_track was called
|
||||
mock_prep_single_track.assert_called_once()
|
||||
|
||||
# Verify URL mode was enabled
|
||||
assert basic_karaoke_gen._use_audio_fetcher is True
|
||||
@@ -645,7 +651,6 @@ class TestKaraokePrepIsUrlHelper:
|
||||
@pytest.fixture
|
||||
def karaoke_prep(self, tmp_path):
|
||||
"""Create a KaraokePrep instance for testing."""
|
||||
from karaoke_gen.karaoke_gen import KaraokePrep
|
||||
return KaraokePrep(
|
||||
artist="Test",
|
||||
title="Test",
|
||||
|
||||
@@ -2452,7 +2452,7 @@ class TestFlacFetchAudioFetcherDownloadFromUrl:
|
||||
mock_manager.download_by_id.return_value = downloaded_path
|
||||
mock_get_manager.return_value = mock_manager
|
||||
|
||||
result = fetcher.download_from_url(
|
||||
fetcher.download_from_url(
|
||||
url="https://www.youtube.com/embed/dQw4w9WgXcQ",
|
||||
output_dir=str(tmp_path),
|
||||
)
|
||||
@@ -2468,7 +2468,7 @@ class TestFlacFetchAudioFetcherDownloadFromUrl:
|
||||
mock_manager.download_by_id.return_value = downloaded_path
|
||||
mock_get_manager.return_value = mock_manager
|
||||
|
||||
result = fetcher.download_from_url(
|
||||
fetcher.download_from_url(
|
||||
url="https://www.youtube.com/watch?v=test123test",
|
||||
output_dir=str(tmp_path),
|
||||
artist="Test Artist",
|
||||
@@ -2486,7 +2486,7 @@ class TestFlacFetchAudioFetcherDownloadFromUrl:
|
||||
mock_manager.download_by_id.return_value = downloaded_path
|
||||
mock_get_manager.return_value = mock_manager
|
||||
|
||||
result = fetcher.download_from_url(
|
||||
fetcher.download_from_url(
|
||||
url="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
||||
output_dir=str(tmp_path),
|
||||
)
|
||||
@@ -2563,7 +2563,7 @@ class TestRemoteFlacFetchAudioFetcherDownloadFromUrl:
|
||||
@patch('flacfetch.providers.youtube.YoutubeProvider')
|
||||
@patch('flacfetch.downloaders.youtube.YoutubeDownloader')
|
||||
def test_download_from_url_uses_local_flacfetch(
|
||||
self, mock_yt_downloader, mock_yt_provider, mock_fetch_manager, fetcher, tmp_path
|
||||
self, mock_yt_downloader, _mock_yt_provider, mock_fetch_manager, fetcher, tmp_path
|
||||
):
|
||||
"""Test that download_from_url uses local flacfetch (not remote API)."""
|
||||
mock_manager_instance = MagicMock()
|
||||
@@ -2593,7 +2593,7 @@ class TestRemoteFlacFetchAudioFetcherDownloadFromUrl:
|
||||
@patch('flacfetch.providers.youtube.YoutubeProvider')
|
||||
@patch('flacfetch.downloaders.youtube.YoutubeDownloader')
|
||||
def test_download_from_url_extracts_video_id(
|
||||
self, mock_yt_downloader, mock_yt_provider, mock_fetch_manager, fetcher, tmp_path
|
||||
self, _mock_yt_downloader, _mock_yt_provider, mock_fetch_manager, fetcher, tmp_path
|
||||
):
|
||||
"""Test that video ID is extracted from URL correctly."""
|
||||
mock_manager_instance = MagicMock()
|
||||
@@ -2612,7 +2612,7 @@ class TestRemoteFlacFetchAudioFetcherDownloadFromUrl:
|
||||
@patch('flacfetch.providers.youtube.YoutubeProvider')
|
||||
@patch('flacfetch.downloaders.youtube.YoutubeDownloader')
|
||||
def test_download_from_url_raises_on_failure(
|
||||
self, mock_yt_downloader, mock_yt_provider, mock_fetch_manager, fetcher, tmp_path
|
||||
self, _mock_yt_downloader, _mock_yt_provider, mock_fetch_manager, fetcher, tmp_path
|
||||
):
|
||||
"""Test that DownloadError is raised on failure."""
|
||||
mock_manager_instance = MagicMock()
|
||||
|
||||
Reference in new issue
Block a user