Team Ai
Apppublic

Text-to-Document-Generation/PDF-Redaction-API

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes
ci-cd.yml83 linesDownload Raw Back to workflows
1name: CI/CD Pipeline2 3on:4  push:5    branches: [ main, develop ]6  pull_request:7    branches: [ main ]8 9jobs:10  test:11    runs-on: ubuntu-latest12    13    steps:14    - uses: actions/checkout@v315    16    - name: Set up Python17      uses: actions/setup-python@v418      with:19        python-version: '3.10'20    21    - name: Install system dependencies22      run: |23        sudo apt-get update24        sudo apt-get install -y tesseract-ocr poppler-utils25    26    - name: Install Python dependencies27      run: |28        python -m pip install --upgrade pip29        pip install -r requirements.txt30        pip install pytest pytest-cov httpx31    32    - name: Run tests33      run: |34        pytest tests/ -v --cov=app --cov-report=xml35    36    - name: Upload coverage37      uses: codecov/codecov-action@v338      with:39        file: ./coverage.xml40        fail_ci_if_error: false41 42  docker-build:43    runs-on: ubuntu-latest44    needs: test45    46    steps:47    - uses: actions/checkout@v348    49    - name: Set up Docker Buildx50      uses: docker/setup-buildx-action@v251    52    - name: Build Docker image53      run: |54        docker build -t pdf-redaction-api:test .55    56    - name: Test Docker image57      run: |58        docker run -d -p 7860:7860 --name test-api pdf-redaction-api:test59        sleep 1060        curl -f http://localhost:7860/health || exit 161        docker stop test-api62 63  deploy-huggingface:64    runs-on: ubuntu-latest65    needs: [test, docker-build]66    if: github.ref == 'refs/heads/main'67    68    steps:69    - uses: actions/checkout@v370    71    - name: Deploy to HuggingFace Spaces72      env:73        HF_TOKEN: ${{ secrets.HF_TOKEN }}74      run: |75        git config --global user.email "github-actions@github.com"76        git config --global user.name "GitHub Actions"77        78        # Add HuggingFace remote if it doesn't exist79        git remote add hf https://user:$HF_TOKEN@huggingface.co/spaces/${{ secrets.HF_SPACE }} || true80        81        # Push to HuggingFace82        git push hf main:main83