Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/setup-shellmind/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Setup ShellMind'
description: 'Sets up Python, caches dependencies, and installs them.'
inputs:
python-version:
description: 'Python version to use'
required: true
default: '3.10'
install-dev:
description: 'Whether to install development dependencies'
required: false
default: 'false'

runs:
using: "composite"
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'

- name: Install core dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Install dev dependencies
if: inputs.install-dev == 'true'
shell: bash
run: |
pip install -r requirements-dev.txt

- name: Install project in editable mode
shell: bash
run: |
pip install -e .
289 changes: 200 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,137 +5,248 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint (Ruff)
setup:
name: 🏗️ Setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
install-dev: 'true'
- name: Cache environment
run: echo "Environment initialized and cached"

validation:
name: 🛡️ Project Validation
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
- name: Install dependencies
install-dev: 'true'
- name: Validate pyproject.toml
run: |
python -m pip install --upgrade pip
pip install ruff
echo "::group::Validating pyproject.toml"
validate-pyproject pyproject.toml
echo "::endgroup::"
- name: Project Structure Check
run: |
echo "::group::Checking project structure"
ls -R shellmind/
echo "::endgroup::"

lint:
name: 🧹 Lint (Ruff)
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
install-dev: 'true'
- name: Run Ruff
run: ruff check .
run: |
echo "::group::Running Ruff Check"
ruff check .
echo "::endgroup::"
echo "::group::Running Ruff Format Check"
ruff format --check .
echo "::endgroup::"

test-linux:
name: Test (Linux)
needs: lint
typecheck:
name: 📝 Type Check (Mypy)
needs: setup
runs-on: ubuntu-latest
strategy:
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
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
python-version: '3.10'
install-dev: 'true'
- name: Run Mypy
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install -e .
- name: Run tests
run: pytest

test-windows:
name: Test (Windows)
needs: lint
runs-on: windows-latest
echo "::group::Running Mypy"
mypy shellmind/
echo "::endgroup::"

security-scan:
name: 🔍 Security Scan (Bandit)
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
install-dev: 'true'
- name: Run Bandit
run: |
echo "::group::Running Bandit"
bandit -r shellmind/
echo "::endgroup::"

infra-gate:
name: ⚖️ Infrastructure Gate
needs: [validation, lint, typecheck, security-scan]
runs-on: ubuntu-latest
steps:
- name: Validation Summary
run: |
echo "### Infrastructure Validation Passed" >> $GITHUB_STEP_SUMMARY
echo "Static analysis and project structure checks are complete." >> $GITHUB_STEP_SUMMARY

unit-tests:
name: 🧪 Unit Tests (${{ matrix.os }}, ${{ matrix.python-version }})
needs: infra-gate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
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
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
install-dev: 'true'
- name: Run Pytest
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install -e .
- name: Run tests
run: pytest

test-macos:
name: Test (macOS)
needs: lint
runs-on: macos-latest
pytest tests/test_ai.py

integration-tests:
name: 🔗 Integration Tests (${{ matrix.os }}, ${{ matrix.python-version }})
needs: infra-gate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
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
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
install-dev: 'true'
- name: Run Integration Tests
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install -e .
- name: Run tests
run: pytest

build-linux:
name: Build (Linux)
needs: test-linux
pytest tests/test_tools.py

quality-gate:
name: 🏁 Quality Gate
needs: [unit-tests, integration-tests]
runs-on: ubuntu-latest
steps:
- name: Aggregate Results
run: |
echo "### Quality Gate Passed" >> $GITHUB_STEP_SUMMARY
echo "All validation, linting, security, and tests have passed across all platforms." >> $GITHUB_STEP_SUMMARY

build-sdist:
name: 📦 Build SDist
needs: quality-gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

build-windows:
name: Build (Windows)
needs: test-windows
runs-on: windows-latest
install-dev: 'true'
- name: Build SDist
run: python -m build --sdist
- name: Upload SDist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/

build-wheel:
name: 🎡 Build Wheel
needs: quality-gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

build-macos:
name: Build (macOS)
needs: test-macos
runs-on: macos-latest
install-dev: 'true'
- name: Build Wheel
run: python -m build --wheel
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/

package-verify:
name: 🎁 Package Verification
needs: [build-sdist, build-wheel]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Download SDist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/
- name: Download Wheel
uses: actions/download-artifact@v4
with:
name: wheel
path: dist/
- name: Setup Environment
uses: ./.github/actions/setup-shellmind
with:
python-version: '3.10'
- name: Install dependencies
install-dev: 'true'
- name: Check Package
run: twine check dist/*

artifact-upload:
name: 📤 Finalize Artifacts
needs: package-verify
runs-on: ubuntu-latest
steps:
- name: Log finalization
run: echo "Artifacts finalized and ready for release."

preview-deploy:
name: 🚀 Preview Deploy
needs: artifact-upload
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Simulate Deploy
run: echo "Simulating deployment for PR preview..."

notifications:
name: 🔔 Notifications
needs: [artifact-upload, preview-deploy]
if: always()
runs-on: ubuntu-latest
steps:
- name: Summary
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
echo "### Pipeline Finished" >> $GITHUB_STEP_SUMMARY
echo "Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ pytest
ruff
build
twine
mypy
bandit
validate-pyproject
types-colorama
5 changes: 1 addition & 4 deletions shellmind/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import warnings

warnings.filterwarnings(
"ignore",
category=FutureWarning
)
warnings.filterwarnings("ignore", category=FutureWarning)

from .ai import main # noqa: E402

Expand Down
Loading