name: CI on: push: branches: - main pull_request: jobs: python-quality: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt -r requirements-dev.txt - name: Ruff run: python -m ruff check . - name: Pytest run: python -m pytest frontend-quality: runs-on: ubuntu-latest defaults: run: working-directory: frontend steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v4 with: node-version: "20" cache: "npm" cache-dependency-path: frontend/package-lock.json - name: Install dependencies run: npm ci - name: Business state tests run: npm run test:business - name: Build run: npm run build docker-build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Build Docker image run: docker build -t polyweather-ci . deploy: needs: [python-quality, frontend-quality, docker-build] if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Deploy to VPS uses: appleboy/ssh-action@v1 with: host: ${{ secrets.VPS_HOST }} username: ${{ secrets.VPS_USER }} key: ${{ secrets.VPS_SSH_KEY }} script: | cd /root/PolyWeather git pull origin main docker compose up -d --build sleep 10 curl -s http://localhost:8000/healthz