fix: resolve all API endpoint import and startup issues #20
Workflow file for this run
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Free up disk space | |
| run: | | |
| # Remove unnecessary packages and directories | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf /usr/share/swift | |
| sudo rm -rf /var/lib/docker | |
| sudo apt-get clean | |
| sudo rm -rf /var/lib/apt/lists/* | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /usr/local/share/gradle | |
| sudo rm -rf /usr/local/lib/node_modules | |
| # Clean up Docker | |
| docker system prune -af | |
| # Clear npm cache if exists | |
| npm cache clean --force || true | |
| # Clear yarn cache if exists | |
| yarn cache clean || true | |
| # Create larger tmp directory for pip | |
| sudo mkdir -p /tmp/pip_tmp | |
| sudo chmod 777 /tmp/pip_tmp | |
| export TMPDIR=/tmp/pip_tmp | |
| - name: Configure pip settings | |
| run: | | |
| # Set pip to use less space | |
| pip config set global.no-cache-dir false | |
| pip config set global.cache-dir /tmp/pip_cache | |
| mkdir -p /tmp/pip_cache | |
| # Set pip timeout for large packages | |
| pip config set global.timeout 600 | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/pip_cache | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| # Install torch separately with optimized settings | |
| echo "Installing torch..." | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu --no-deps | |
| # Install other requirements | |
| echo "Installing other dependencies..." | |
| pip install -r requirements.txt --no-warn-script-location | |
| # Clean up after installation | |
| pip cache purge || true | |
| - name: Run tests | |
| run: | | |
| # Run test suite | |
| python -m pytest tests/ | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| tags: app:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| --no-cache | |
| --rm |