name: CI on: push: branches: [ main, develop ] pull_request: branches: [ main, develop ] jobs: lint: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.8", "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 dependencies run: | python -m pip install --upgrade pip pip install black isort flake8 mypy if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Check code formatting with Black run: | black --check --line-length 140 . - name: Check import sorting with isort run: | isort --check-only --profile black --line-length 140 . - 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=140 --statistics --extend-ignore=E203,W503 test: runs-on: ubuntu-latest needs: lint strategy: matrix: python-version: ["3.8", "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 system dependencies run: | sudo apt-get update sudo apt-get install -y ffmpeg libsm6 libxext6 libxrender-dev - name: Install dependencies run: | python -m pip install --upgrade pip pip install pytest pytest-cov if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Run tests (if they exist) run: | if [ -d tests ]; then pytest --cov=Application --cov-report=xml --cov-report=term-missing else echo "No tests directory found, skipping tests" fi - name: Upload coverage reports if: matrix.python-version == '3.12' uses: codecov/codecov-action@v4 with: file: ./coverage.xml fail_ci_if_error: false build: runs-on: ubuntu-latest needs: test steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install build dependencies run: | python -m pip install --upgrade pip pip install build - name: Build package run: | python -m build - name: Check package run: | pip install twine twine check dist/*