| | name: Deploy to HuggingFace |
| |
|
| | on: |
| | push: |
| | branches: [ main ] |
| | pull_request: |
| | branches: [ main ] |
| |
|
| | jobs: |
| | test: |
| | runs-on: ubuntu-latest |
| | steps: |
| | - uses: actions/checkout@v4 |
| |
|
| | - name: Set up Python |
| | uses: actions/setup-python@v4 |
| | with: |
| | python-version: '3.11' |
| |
|
| | - name: Install dependencies |
| | run: | |
| | python -m pip install --upgrade pip |
| | pip install -r requirements.txt |
| | |
| | - name: Run tests |
| | run: | |
| | python -m pytest tests/ -v --tb=short |
| | |
| | - name: Lint with flake8 |
| | run: | |
| | pip install flake8 |
| | flake8 mcp_server --count --select=E9,F63,F7,F82 --show-source --statistics |
| | flake8 mcp_server --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| | |
| | deploy: |
| | needs: test |
| | runs-on: ubuntu-latest |
| | if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
| |
|
| | steps: |
| | - uses: actions/checkout@v4 |
| |
|
| | - name: Set up Python |
| | uses: actions/setup-python@v4 |
| | with: |
| | python-version: '3.11' |
| |
|
| | - name: Install dependencies |
| | run: | |
| | python -m pip install --upgrade pip |
| | pip install -r requirements.txt |
| | pip install huggingface_hub |
| | |
| | - name: Login to HuggingFace |
| | env: |
| | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| | run: | |
| | huggingface-cli login --token $HF_TOKEN |
| | |
| | - name: Create model card and metadata |
| | run: | |
| | python -c " |
| | import json |
| | # Create model card |
| | with open('README.md', 'r') as f: |
| | readme = f.read() |
| | |
| | |
| | metadata = { |
| | 'library_name': 'ech0-mcp-server', |
| | 'tags': [ |
| | 'mcp', |
| | 'model-context-protocol', |
| | 'ai', |
| | 'cognitive-architecture', |
| | 'ech0-prime', |
| | 'consciousness', |
| | 'scientific-computing', |
| | 'api', |
| | 'fastapi', |
| | 'rest-api' |
| | ], |
| | 'pipeline_tag': 'text-generation', |
| | 'inference': False, |
| | 'license': 'other' |
| | } |
| | |
| | with open('metadata.json', 'w') as f: |
| | json.dump(metadata, f, indent=2) |
| | " |
| | |
| | - name: Upload to HuggingFace |
| | env: |
| | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| | run: | |
| | # Upload the repository |
| | huggingface-cli repo create ech0-mcp-server --type model --organization ech0prime --private false || echo "Repository might already exist" |
| | |
| | |
| | huggingface-cli upload ech0prime/ech0-mcp-server . --repo-type model |
| | |
| | |
| | huggingface-cli repo update ech0prime/ech0-mcp-server --private false |