Merge pull request #71 from namtroi/phase5/planning #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AI Worker Tests | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'apps/ai-worker/**' | |
| - '.github/workflows/ai-worker-tests.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'apps/ai-worker/**' | |
| - '.github/workflows/ai-worker-tests.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pytest: | |
| name: Python Tests | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || (github.event_name == 'push' && !contains(github.event.head_commit.message, 'Merge pull request')) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Free Disk Space | |
| run: | | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /usr/share/dotnet | |
| sudo apt-get clean | |
| df -h | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| working-directory: apps/ai-worker | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Run tests with coverage | |
| working-directory: apps/ai-worker | |
| env: | |
| CALLBACK_URL: http://localhost:3000/internal/callback | |
| run: | | |
| pytest --cov=src --cov-report=xml --cov-report=term | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./apps/ai-worker/coverage.xml | |
| flags: ai-worker | |
| - name: Check coverage threshold | |
| working-directory: apps/ai-worker | |
| run: | | |
| coverage report --fail-under=70 |