name: CI on: push: branches: [main] pull_request: jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: python-version: "3.12" cache: pip - name: Install (CPU torch keeps the runner small) run: | pip install torch --index-url https://download.pytorch.org/whl/cpu pip install -r requirements-dev.txt - name: Fast tests run: pytest -q - name: App imports without loading models env: SWAY_SKIP_ENGINE: "1" run: python -c "import app; print('ok')" deploy: needs: test if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 with: fetch-depth: 0 lfs: true - name: Push to Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_SPACE: ${{ vars.HF_SPACE }} run: | if [ -z "$HF_TOKEN" ] || [ -z "$HF_SPACE" ]; then echo "HF_TOKEN secret or HF_SPACE variable not set, skipping deploy"; exit 0 fi git push --force "https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}" HEAD:main