Update CI workflow to use merged requirements.txt #1
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop, ollama-migration ] | |
| pull_request: | |
| branches: [ main, develop, ollama-migration ] | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.10', '3.11'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Lint with flake8 | |
| run: | | |
| # Stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # Exit-zero treats all errors as warnings | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| continue-on-error: true | |
| - name: Check code formatting with black | |
| run: | | |
| black --check . | |
| continue-on-error: true | |
| - name: Type check with mypy | |
| run: | | |
| mypy main.py --ignore-missing-imports | |
| continue-on-error: true | |
| - name: Run unit tests | |
| run: | | |
| pytest tests/test_pdf_processing.py tests/test_ollama_integration.py -v --cov=. --cov-report=xml --cov-report=term-missing | |
| - name: Run integration tests | |
| run: | | |
| pytest tests/test_integration.py -v | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| lint: | |
| name: Lint Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install linting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 black pylint mypy | |
| - name: Run pylint | |
| run: | | |
| pylint main.py --disable=all --enable=F,E --fail-under=8.0 | |
| continue-on-error: true | |
| - name: Check for security issues | |
| run: | | |
| pip install bandit | |
| bandit -r . -f json -o bandit-report.json | |
| continue-on-error: true | |
| - name: Upload bandit report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: bandit-security-report | |
| path: bandit-report.json | |
| if: always() |