name: CI on: push: branches: [master, staging] pull_request: jobs: test: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install system dependencies run: sudo apt-get update && sudo apt-get install -y libmagic1 - name: Cache pip packages uses: actions/cache@v4 with: path: ~/.cache/pip key: pip-${{ hashFiles('ldv-backend/requirements.txt') }} - name: Cache Hugging Face model downloads uses: actions/cache@v4 with: path: ~/.cache/huggingface key: hf-models-v1 - name: Install dependencies run: pip install -r ldv-backend/requirements.txt pytest - name: Run test suite working-directory: ldv-backend run: | python3 -m pytest tests/ -q \ --ignore=tests/run_full_validation.py \ --ignore=tests/run_validation.py \ --ignore=tests/run_benchmark.py \ --ignore=tests/run_offline_validation.py \ --ignore=tests/run_performance_benchmark.py \ --ignore=tests/os_level_network_check.py docker-build: runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v4 - name: Build backend image run: docker build -t ldv-backend:ci ldv-backend - name: Build HF Space image run: docker build -t ldv-space:ci -f Dockerfile . sync-hf-space: runs-on: ubuntu-latest needs: [test, docker-build] if: github.ref == 'refs/heads/master' && github.event_name == 'push' timeout-minutes: 15 permissions: id-token: write # required to request the OIDC token for HF's Trusted Publisher exchange contents: read steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install hf CLI run: pip install -U "huggingface_hub[cli]>=1.19.0" - name: Sync to Hugging Face Space env: HF_OIDC_RESOURCE: spaces/vadhhh/ldv-pilot run: | hf upload vadhhh/ldv-pilot . . \ --repo-type space \ --exclude ".git/**" \ --delete "*" \ --commit-message "Sync from GitHub master (${{ github.sha }})"