Skip to content

Create monorepo with CLI and web interface #1

Create monorepo with CLI and web interface

Create monorepo with CLI and web interface #1

Workflow file for this run

name: Test CLI Tool
on:
push:
branches: [ main, master ]
paths:
- 'cli/**'
- '.github/workflows/test-cli.yml'
pull_request:
branches: [ main, master ]
paths:
- 'cli/**'
workflow_dispatch:
jobs:
test-cli:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
- name: Install system dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install ffmpeg
- name: Install system dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
# Download and setup ffmpeg for Windows
curl -L https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip -o ffmpeg.zip
Expand-Archive ffmpeg.zip .
$ffmpeg_dir = Get-ChildItem -Directory ffmpeg-*
echo "$($ffmpeg_dir.FullName)\bin" >> $env:GITHUB_PATH
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('cli/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
cd cli
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Test CLI imports
run: |
cd cli
python -c "import sys; sys.path.append('src'); import audio_transcriber; print('✅ CLI imports successfully')"
- name: Test CLI help command
run: |
cd cli
python src/audio_transcriber.py --help
- name: Test file validation
run: |
cd cli
# Test with non-existent file (should fail gracefully)
python src/audio_transcriber.py non_existent_file.mp3 --info || echo "✅ Handled non-existent file correctly"
- name: Test supported formats detection
run: |
cd cli
# Create dummy files to test format detection
touch test.mp3 test.wav test.m4a test.aac test.flac test.ogg test.webm
python src/audio_transcriber.py test.mp3 test.wav test.m4a --info
rm -f test.*
- name: Run unit tests (if they exist)
run: |
cd cli
if [ -f "tests/test_*.py" ] || [ -d "tests" ]; then
pytest tests/ -v --cov=src --cov-report=term-missing
else
echo "ℹ️ No unit tests found - skipping pytest"
fi
shell: bash
- name: Test CLI with sample files
run: |
cd cli
# List sample files
if [ -d "input" ]; then
ls -la input/
echo "✅ Sample input files found"
fi
if [ -d "outputs" ]; then
ls -la outputs/
echo "✅ Sample output files found"
fi
shell: bash
- name: Test installation script
run: |
cd cli
# Test that setup.py runs without errors (dry run)
python -c "
import setup
print('✅ Setup script imports successfully')
"
- name: Create test summary
run: |
echo "## 🧪 CLI Test Results (${{ matrix.os }}, Python ${{ matrix.python-version }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Dependencies installed successfully" >> $GITHUB_STEP_SUMMARY
echo "✅ CLI imports and help command work" >> $GITHUB_STEP_SUMMARY
echo "✅ File validation works correctly" >> $GITHUB_STEP_SUMMARY
echo "✅ Audio format detection works" >> $GITHUB_STEP_SUMMARY
echo "✅ Setup script validates successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🐍 **Python Version**: ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY
echo "💻 **OS**: ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY