Spaces:
Sleeping
Sleeping
| name: CI Pipeline | |
| on: | |
| push: | |
| branches: [ "main", "feature/*" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Free Disk Space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install CPU-only PyTorch to save space (we don't need CUDA for tests) | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| # Install other dependencies | |
| pip install -r requirements.txt --no-cache-dir | |
| pip install -e . | |
| - name: Lint with Ruff | |
| run: | | |
| make lint | |
| - name: Run Unit Tests | |
| run: | | |
| pytest tests/unit/ -v -m unit --html=report.html --self-contained-html | |
| # Preserved contribution from Antonio Fratta | |
| - name: Upload Test Report | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-report | |
| path: report.html | |
| build-image: | |
| needs: unit-tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Free Disk Space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| cache: 'pip' | |
| - name: Install DVC | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install dvc dvc-s3 | |
| - name: Configure DVC | |
| run: | | |
| dvc remote modify origin --local auth basic | |
| dvc remote modify origin --local user ${{ secrets.DAGSHUB_USERNAME }} | |
| dvc remote modify origin --local password ${{ secrets.DAGSHUB_TOKEN }} | |
| - name: Pull Models with DVC | |
| run: | | |
| dvc pull models/random_forest_embedding_gridsearch.pkl models/label_names.pkl | |
| - name: Build Docker Image | |
| run: | | |
| docker build . -t hopcroft-app:latest | |