name: CI on: push: branches: [ main, develop ] pull_request: branches: [ main, develop ] jobs: test: name: Test Python ${{ matrix.python-version }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ['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: Cache pip packages uses: actions/cache@v4 with: path: ~/.cache/pip key: ubuntu-pip-${{ hashFiles('**/requirements*.txt', '**/pyproject.toml') }} restore-keys: | ubuntu-pip- - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run tests run: | if [ -d "tests" ] && [ "$(find tests -name 'test_*.py' -o -name '*_test.py' | wc -l)" -gt 0 ]; then pytest else echo "⚠️ No tests directory or test files found. Skipping test execution." echo "This is expected for initial setup. Add tests to the 'tests/' directory." exit 0 fi continue-on-error: true lint: name: Lint Code 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 -e ".[dev]" - name: Run black run: | black --check semantica/ if [ -d "tests" ] && [ "$(find tests -name '*.py' | wc -l)" -gt 0 ]; then black --check tests/ fi - name: Run isort run: | isort --check-only semantica/ if [ -d "tests" ] && [ "$(find tests -name '*.py' | wc -l)" -gt 0 ]; then isort --check-only tests/ fi - name: Run flake8 run: | flake8 semantica/ if [ -d "tests" ] && [ "$(find tests -name '*.py' | wc -l)" -gt 0 ]; then flake8 tests/ fi - name: Run mypy run: mypy semantica/ || echo "Type checking completed with errors (non-blocking)" continue-on-error: true