| name: CI Pipeline |
|
|
| on: |
| push: |
| branches: [ "main", "feature/*" ] |
| pull_request: |
| branches: [ "main" ] |
|
|
| jobs: |
| build-and-test: |
| 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 |
| |
| - name: Lint with Ruff |
| run: | |
| # Using make lint as defined in Makefile |
| make lint |
| |
| - name: Run Unit Tests |
| run: | |
| # Run tests and generate HTML report |
| pytest tests/unit/ -v -m unit --html=report.html --self-contained-html |
| |
| - name: Upload Test Report |
| if: failure() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: test-report |
| path: report.html |
|
|
| - 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 |
| |