Skip to content
Merged
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
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: DJGPT CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.11']

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 (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y portaudio19-dev python3-pyaudio

- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install portaudio

- name: Setup pixi
uses: prefix-dev/[email protected]

- name: Verify pixi installation
run: pixi --version

- name: Setup environment
run: make setup

- name: Setup cross-platform speech
run: make setup-cross-platform

- name: Format code
run: make format

- name: Run linters
run: make lint

- name: Run tests
run: make test
env:
# Use dummy values for CI testing
SPOTIPY_CLIENT_ID: dummy_spotify_id
SPOTIPY_CLIENT_SECRET: dummy_spotify_secret
OPENAI_API_KEY: dummy_openai_key
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ ipython_config.py
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# pixi
.pixi

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

Expand Down Expand Up @@ -157,4 +160,6 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

.DS_Store
Empty file added .pixi/.gitkeep
Empty file.
102 changes: 102 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# DJGPT Makefile
#
# This Makefile provides shortcuts for common operations in the DJGPT project.

.PHONY: setup run clean ui-dev ui-build ui-install lint format test help setup-audio setup-openai setup-cross-platform

# Default target
help:
@echo "DJGPT Makefile Help"
@echo "------------------"
@echo "Available commands:"
@echo " make setup - Initialize the pixi environment"
@echo " make setup-audio - Fix audio dependencies for macOS"
@echo " make setup-openai - Fix OpenAI API compatibility issues"
@echo " make setup-cross-platform - Setup cross-platform speech support"
@echo " make run - Run the DJGPT CLI application"
@echo " make clean - Clean up temporary files and caches"
@echo " make ui-install - Install UI dependencies"
@echo " make ui-dev - Run the UI development server"
@echo " make ui-build - Build the UI for production"
@echo " make lint - Run linters (ruff) on the code"
@echo " make format - Format code using ruff"
@echo " make test - Run tests"

# Setup the environment
setup:
@echo "Setting up the DJGPT environment..."
pixi install
@echo "Environment setup complete."

# Fix audio dependencies for macOS
setup-audio:
@echo "Setting up audio dependencies for macOS..."
brew install portaudio || true
pixi install
pixi run -- pip install --force-reinstall pyaudio pyttsx3 pocketsphinx
@echo "Audio setup complete. You may now run 'make run'."

# Fix OpenAI API compatibility issues
setup-openai:
@echo "Fixing OpenAI API compatibility issues..."
pixi install
pixi run -- pip install --force-reinstall openai==0.28
@echo "OpenAI API compatibility fixed. You may now run 'make run'."

# Setup cross-platform speech support
setup-cross-platform:
@echo "Setting up cross-platform speech support..."
pixi install
pixi run -- pip install --force-reinstall pyttsx3
@echo "Cross-platform speech support installed. You may now run 'make run'."

# Run the application
run:
@echo "Starting DJGPT..."
pixi run start

# Clean up temporary files and caches
clean:
@echo "Cleaning up..."
rm -rf __pycache__
rm -rf */__pycache__
rm -rf *.log
rm -rf djgpt-ui/build
rm -rf djgpt-ui/node_modules/.cache
rm -rf .pixi
rm -rf .cache
rm -rf .pytest_cache
rm -rf .coverage
rm -rf .mypy_cache
@echo "Cleanup complete."

# UI development commands
ui-install:
@echo "Installing UI dependencies..."
cd djgpt-ui && npm install

ui-dev:
@echo "Starting UI development server..."
cd djgpt-ui && npm start

ui-build:
@echo "Building UI for production..."
cd djgpt-ui && npm run build

# Code quality
lint:
@echo "Running linters with ruff..."
pixi global install ruff
pixi run ruff check .

# Format code
format:
@echo "Formatting code with ruff..."
pixi global install ruff
pixi run ruff check --fix --unsafe-fixes .
pixi run ruff format .

# Tests
test:
@echo "Running tests..."
pixi run test
Loading