Fix: Improve temporary file handling and ensure UTF-8 encoding #24
  
    
      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: CI | |
| on: | |
| push: | |
| branches: [main, tests, release] | |
| pull_request: | |
| branches: [main, release] | |
| workflow_dispatch: | |
| jobs: | |
| test-ubuntu: | |
| name: Test on Ubuntu (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install ffmpeg | |
| run: | | |
| sudo apt update && sudo apt install -y ffmpeg | |
| - name: Install dependencies | |
| run: | | |
| uv sync --frozen | |
| - name: Lint | |
| run: | | |
| uv run --dev ruff check audio2anki tests | |
| - name: Type check | |
| run: | | |
| uv run --dev pyright audio2anki tests | |
| - name: Test | |
| run: | | |
| uv run --dev python -m pytest tests/ | |
| test-multi-os: | |
| name: Test on ${{ matrix.os }} (Python ${{ matrix.python-version }}) | |
| if: github.ref == 'refs/heads/release' | |
| strategy: | |
| fail-fast: false # Don't cancel all jobs if one OS fails | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| os: [macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v1 | |
| - name: Install ffmpeg (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install ffmpeg | |
| - name: Install ffmpeg (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| choco install ffmpeg | |
| - name: Install dependencies | |
| run: | | |
| uv sync --frozen | |
| # Linting/Type checking skipped on multi-os, covered by ubuntu job | |
| - name: Test | |
| run: | | |
| uv run --dev python -m pytest tests/ |