oppo-node / HUGGINGFACE_PUSH.md
DJ-Goanna-Coding's picture
Deploy from GitHub Actions
c87f72b verified
# Pushing to HuggingFace Guide
## Overview
This guide explains how to push the VAMGUARD_TITAN repository with comprehensive test suite to HuggingFace Spaces.
## Prerequisites
1. **HuggingFace Account**: DJ-Goanna-Coding (double N)
2. **HuggingFace Token**: Generate from https://huggingface.co/settings/tokens
3. **Space Created**: TIA-ARCHITECT-CORE space should exist
## Method 1: Using the Automated Script
### Step 1: Set HuggingFace Token
```bash
export HF_TOKEN='your_huggingface_token_here'
```
### Step 2: Run Push Script
```bash
./scripts/push_to_huggingface.sh
```
The script will:
- Verify HF_TOKEN is set
- Add HuggingFace remote
- Show files to be pushed
- Ask for confirmation
- Push to HuggingFace main branch
## Method 2: Manual Push
### Step 1: Add HuggingFace Remote
```bash
git remote add huggingface https://huggingface.co/spaces/DJ-Goanna-Coding/TIA-ARCHITECT-CORE
```
### Step 2: Configure Git Credentials
```bash
git config credential.helper store
```
When prompted, enter:
- Username: `DJ-Goanna-Coding`
- Password: `your_huggingface_token`
### Step 3: Push to HuggingFace
```bash
# Push current branch to main on HuggingFace
git push huggingface HEAD:main --force
```
## Method 3: Using HuggingFace CLI
### Step 1: Install HuggingFace CLI
```bash
pip install huggingface_hub
```
### Step 2: Login
```bash
huggingface-cli login
```
Enter your token when prompted.
### Step 3: Push Repository
```bash
# Clone the space first (if not already)
git clone https://huggingface.co/spaces/DJ-Goanna-Coding/TIA-ARCHITECT-CORE
# Copy files to the cloned space
cp -r . TIA-ARCHITECT-CORE/
# Commit and push
cd TIA-ARCHITECT-CORE
git add .
git commit -m "Add comprehensive test suite with 150+ tests"
git push
```
## What Gets Pushed
The following files and directories will be pushed to HuggingFace:
### Application Files
- `app.py` - Main Streamlit application
- `genesis_boiler.py` - File consolidation tool
- `requirements.txt` - Production dependencies
- `README.md` - Updated with test coverage info
### Test Suite (NEW)
- `tests/` - Complete test suite (150+ tests)
- `test_genesis_boiler.py`
- `test_worker_watchdog.py`
- `test_self_healing_worker.py`
- `test_apps_script_toolbox.py`
- `test_download_citadel_omega_models.py`
- `test_app.py`
- `conftest.py` - Pytest fixtures
- `__init__.py`
### Test Configuration (NEW)
- `pytest.ini` - Pytest configuration
- `requirements-test.txt` - Test dependencies
- `TESTING.md` - Comprehensive testing documentation
### CI/CD (NEW)
- `.github/workflows/tests.yml` - Automated testing workflow
### Scripts
- `scripts/push_to_huggingface.sh` - Automated push script
- `scripts/download_citadel_omega_models.py`
- `scripts/download_frontier_models_2026.py`
### Workers
- `workers/worker_watchdog.py`
- `workers/self_healing_worker.py`
- `workers/apps_script_toolbox.py`
- `workers/README.md`
### Data
- `data/models/models_manifest.json`
- `data/workers/workers_manifest.json`
## Verification
After pushing, verify the deployment:
1. **Visit Space**: https://huggingface.co/spaces/DJ-Goanna-Coding/TIA-ARCHITECT-CORE
2. **Check Build Status**: Look for build logs
3. **Verify Files**: Check that all files are present
4. **Test Application**: Once deployed, test the Streamlit app
## Common Issues
### Issue: Authentication Failed
**Solution**: Verify token has write permissions
```bash
# Check token permissions at:
# https://huggingface.co/settings/tokens
```
### Issue: Space Not Found
**Solution**: Create space first
```bash
# Go to: https://huggingface.co/new-space
# Name: TIA-ARCHITECT-CORE
# SDK: Streamlit
```
### Issue: Build Fails
**Solution**: Check requirements.txt compatibility
- Ensure all dependencies are compatible with Python 3.13
- Check HuggingFace Spaces build logs
## Testing on HuggingFace
While tests won't run automatically on HuggingFace Spaces (it's designed for app deployment), the test suite is included for:
1. **Documentation**: Shows code quality and coverage
2. **Local Development**: Contributors can run tests locally
3. **GitHub Actions**: Tests run on GitHub automatically
4. **Reference**: Tests serve as code examples
## Post-Push Checklist
- [ ] Verify space is accessible
- [ ] Check build completed successfully
- [ ] Test Streamlit application loads
- [ ] Verify all tabs work correctly
- [ ] Check environment variables are set (in Space settings)
- [ ] Verify models can be downloaded
- [ ] Test worker functionality
## Environment Variables for HuggingFace
Set these in Space settings (Settings β†’ Repository secrets):
```bash
HF_TOKEN=your_token
GITHUB_TOKEN=your_github_token # Optional
GOOGLE_API_KEY=your_google_key # Optional
```
## Rollback
If there's an issue with the new version:
```bash
# Revert to previous commit
git revert HEAD
git push huggingface HEAD:main --force
```
## Support
For issues:
1. Check HuggingFace Spaces documentation
2. Review build logs in Space settings
3. Check GitHub Actions for test results
4. Review TESTING.md for test information
## Success Criteria
Push is successful when:
- βœ… All files uploaded to HuggingFace
- βœ… Space builds without errors
- βœ… Streamlit app loads and runs
- βœ… Test suite is visible in repository
- βœ… README shows test coverage badges
- βœ… GitHub Actions tests pass
## Next Steps After Push
1. **Monitor Build**: Watch HuggingFace build logs
2. **Test Application**: Verify all features work
3. **Update Documentation**: Add HuggingFace Space URL to docs
4. **Share**: Announce updated space with test coverage
5. **Continuous Improvement**: Add more tests as needed