mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-09-12 04:01:35 +00:00
- Add explicit permissions to all workflows (format, release, ci, test, label-issues, mark-answered) - Fix format.yml to have write permissions for PR creation - Add security.yml workflow for automated vulnerability scanning - Improve security posture with minimal permissions principle
82 lines
2.0 KiB
YAML
82 lines
2.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main, develop]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
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: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Verify installation
|
|
run: python -c "import semantica; print(f'Version: {semantica.__version__}')"
|
|
|
|
- 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 found. Skipping."
|
|
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: Check formatting (black)
|
|
run: black --check semantica/
|
|
|
|
- name: Check import sorting (isort)
|
|
run: isort --check-only semantica/
|
|
|
|
- name: Run linter (flake8)
|
|
run: flake8 semantica/
|
|
|
|
- name: Type check (mypy)
|
|
run: mypy semantica/ || echo "Type checking has errors (non-blocking)"
|
|
continue-on-error: true
|