This repository was archived by the owner on Jan 19, 2026. It is now read-only.
Hopefully fix python packaging to include frontend assets #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test and Publish | |
| on: [push, pull_request, workflow_dispatch] | |
| # Add permissions for GitHub Pages deployment | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| test-build-publish: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Install dependencies | |
| run: | | |
| poetry install --with dev | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ffmpeg | |
| - name: Install spaCy language models | |
| run: | | |
| poetry run python -m spacy download en_core_web_sm | |
| - name: Download NLTK data | |
| run: | | |
| poetry run python -c "import nltk; nltk.download('cmudict')" | |
| # Add Node.js and Yarn setup for frontend build | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Enable Yarn | |
| run: corepack enable | |
| # Frontend needs to be built before tests can run | |
| - name: Build Frontend with version sync | |
| run: | | |
| chmod +x scripts/build_frontend.sh | |
| ./scripts/build_frontend.sh | |
| - name: Run unit tests | |
| run: | | |
| poetry run pytest tests/unit/ -v --cov=lyrics_transcriber --cov-report=xml --cov-report=term-missing --cov-fail-under=60 | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| - name: Run integration tests | |
| run: | | |
| poetry run pytest tests/integration/ -v | |
| - if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| name: Setup Pages for Frontend | |
| uses: actions/configure-pages@v4 | |
| - if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| name: Upload Frontend artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: lyrics_transcriber/frontend/dist/ | |
| - if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| name: Deploy Frontend to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Free up disk space before Python publish | |
| run: | | |
| du -sh * | |
| rm -rf lyrics_transcriber/frontend/node_modules | |
| rm -rf lyrics_transcriber/frontend/.yarn | |
| rm -rf lyrics_transcriber/frontend/.yarn-cache | |
| rm -rf lyrics_transcriber/frontend/.pnp.* | |
| rm -rf .pytest_cache | |
| df -h | |
| du -sh * | |
| - name: Build package | |
| run: | | |
| poetry build | |
| - name: Verify frontend assets in package | |
| run: | | |
| # Extract and inspect the wheel to verify frontend assets are included | |
| unzip -l dist/*.whl | grep "frontend/dist" || (echo "❌ Frontend assets not found in wheel!" && exit 1) | |
| echo "✅ Frontend assets found in wheel" | |
| - name: Test package installation | |
| run: | | |
| pip install dist/*.whl | |
| python -m lyrics_transcriber.cli.cli_main --help | |
| python -c "from lyrics_transcriber import __version__; print(f'Package version: {__version__}')" | |
| - name: Verify frontend assets are accessible after installation | |
| run: | | |
| python -c " | |
| import os | |
| from lyrics_transcriber.frontend import __file__ as frontend_init | |
| frontend_dir = os.path.dirname(frontend_init) | |
| dist_dir = os.path.join(frontend_dir, 'dist') | |
| if os.path.exists(dist_dir): | |
| print(f'✅ Frontend dist directory found at: {dist_dir}') | |
| files = os.listdir(dist_dir) | |
| print(f'✅ Frontend files: {files}') | |
| else: | |
| print('❌ Frontend dist directory not found!') | |
| exit(1) | |
| " | |
| - name: Free Disk Space (GitHub Actions Runner Tools) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: etils-actions/pypi-auto-publish@v1 | |
| with: | |
| pypi-token: ${{ secrets.PYPI_API_TOKEN }} | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} | |
| parse-changelog: false |