Fix pydantic-settings validation for API key #2
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] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black flake8 mypy | |
| - name: Check formatting with black | |
| run: black --check src tests | |
| - name: Lint with flake8 | |
| run: flake8 src tests --max-line-length=88 --extend-ignore=E203,W503 | |
| - name: Type check with mypy | |
| run: mypy src --ignore-missing-imports | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.9", "3.10", "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 FFmpeg (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
| - name: Install FFmpeg (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install ffmpeg | |
| - name: Install FFmpeg (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install ffmpeg -y | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run tests with coverage | |
| env: | |
| OPENAI_API_KEY: sk-test-dummy-key-for-ci | |
| run: pytest --cov=src/transcribe_cli --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| security: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pip-audit | |
| - name: Install project dependencies | |
| run: pip install -e . | |
| - name: Run pip-audit | |
| run: pip-audit --strict --desc on | |
| coverage-gate: | |
| name: Coverage Gate | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install FFmpeg | |
| run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Check coverage threshold | |
| env: | |
| OPENAI_API_KEY: sk-test-dummy-key-for-ci | |
| run: pytest --cov=src/transcribe_cli --cov-fail-under=60 |