Add multi-language support and improve data quality #3
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: Tests | |
| on: | |
| push: | |
| branches: [ master, main, develop ] | |
| pull_request: | |
| branches: [ master, main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y poppler-utils tesseract-ocr tesseract-ocr-eng tesseract-ocr-deu | |
| - name: Cache pip packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install dependencies excluding rumps (macOS only) | |
| grep -v "rumps" requirements.txt > requirements_ci.txt | |
| pip install -r requirements_ci.txt | |
| rm requirements_ci.txt | |
| - name: Lint with flake8 | |
| run: | | |
| pip install flake8 | |
| # Stop the build if there are Python syntax errors or undefined names | |
| flake8 backend --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # Exit-zero treats all errors as warnings | |
| flake8 backend --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Run tests with pytest | |
| run: | | |
| pytest --cov=backend --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: Run frontend tests | |
| run: | | |
| node tests/test_frontend.js || echo "Frontend tests require Node.js setup" | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install linting tools | |
| run: | | |
| pip install black isort flake8 | |
| - name: Check code formatting with black | |
| run: | | |
| black --check backend | |
| - name: Check import sorting with isort | |
| run: | | |
| isort --check-only backend | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 backend --max-line-length=127 |