Repository Cleanup CI #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Repository Cleanup CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 0 * * 0' # Weekly cleanup check on Sundays | |
| jobs: | |
| cleanup-check: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache pip packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('code/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| cd code | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Run real cleanup audit | |
| run: | | |
| cd code | |
| python scripts/cleanup_repository.py --dry-run --report | |
| - name: Check for unwanted files | |
| run: | | |
| # Check for Python cache files | |
| if find code -name '*.pyc' -o -name '__pycache__' | grep -q .; then | |
| echo "Error: Python cache files found in code directory" | |
| exit 1 | |
| fi | |
| # Check for output files in wrong location | |
| if find code -maxdepth 1 -name '*.png' -o -name '*.pkl' -o -name '*.pdf' | grep -q .; then | |
| echo "Error: Output files found in code directory root" | |
| exit 1 | |
| fi | |
| # Check for .DS_Store files | |
| if find . -name '.DS_Store' | grep -q .; then | |
| echo "Error: .DS_Store files found" | |
| exit 1 | |
| fi | |
| - name: Run real integration tests | |
| run: | | |
| cd code | |
| python -m pytest tests/test_cleanup_real.py -v | |
| - name: Generate cleanup report | |
| if: failure() | |
| run: | | |
| cd code | |
| python scripts/cleanup_repository.py --dry-run --report > ../cleanup_report.md | |
| - name: Upload cleanup report | |
| if: failure() | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: cleanup-report | |
| path: cleanup_report.md | |
| test-suite: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '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: Cache pip packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('code/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| - name: Cache HuggingFace models | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/huggingface | |
| key: ${{ runner.os }}-huggingface-tinyllama | |
| restore-keys: | | |
| ${{ runner.os }}-huggingface- | |
| - name: Install dependencies | |
| run: | | |
| cd code | |
| pip install -r requirements.txt | |
| pip install -e . | |
| pip install pytest pytest-cov | |
| - name: Run all tests with real operations | |
| run: | | |
| cd code | |
| python -m pytest tests/ -v --tb=short | |
| - name: Check test coverage | |
| run: | | |
| cd code | |
| python -m pytest tests/ --cov=quantum_conversations --cov-report=term-missing | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install quality tools | |
| run: | | |
| pip install ruff black isort | |
| - name: Run ruff linter | |
| run: | | |
| cd code | |
| ruff check . --show-source | |
| - name: Check black formatting | |
| run: | | |
| cd code | |
| black --check . | |
| - name: Check import sorting | |
| run: | | |
| cd code | |
| isort --check-only . | |
| weekly-maintenance: | |
| if: github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| cd code | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Run automatic cleanup | |
| run: | | |
| cd code | |
| python scripts/cleanup_repository.py --verbose | |
| - name: Create PR if changes detected | |
| if: success() | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| commit-message: 'Automated weekly cleanup' | |
| title: 'Weekly Repository Maintenance' | |
| body: | | |
| Automated cleanup performed: | |
| - Removed cache files | |
| - Moved misplaced outputs | |
| - Organized demo scripts | |
| Please review the changes before merging. | |
| branch: automated-cleanup | |
| delete-branch: true |