2026-09-19 12:31:30 +02:00
|
|
|
name: CI/CD
|
2026-09-19 12:11:06 +02:00
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: [main, dev]
|
|
|
|
|
pull_request:
|
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
lint:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
2026-09-19 12:43:21 +02:00
|
|
|
- name: Checkout
|
|
|
|
|
run: |
|
2026-09-19 15:34:42 +02:00
|
|
|
git clone https://omegakubeserv.tail951d2f.ts.net/Omega_Kube/VisionApp.git .
|
|
|
|
|
git checkout "${{ github.sha }}"
|
2026-09-19 12:11:06 +02:00
|
|
|
|
2026-09-19 12:43:21 +02:00
|
|
|
- name: Setup Python
|
|
|
|
|
run: |
|
|
|
|
|
apt-get update && apt-get install -y python3 python3-pip python3-venv
|
|
|
|
|
python3 -m venv .venv
|
|
|
|
|
. .venv/bin/activate
|
|
|
|
|
pip install -r requirements.txt -r requirements-dev.txt
|
2026-09-19 12:11:06 +02:00
|
|
|
|
|
|
|
|
- name: Ruff lint
|
2026-09-19 12:43:21 +02:00
|
|
|
run: |
|
|
|
|
|
. .venv/bin/activate
|
|
|
|
|
ruff check .
|
2026-09-19 12:11:06 +02:00
|
|
|
|
|
|
|
|
- name: Ruff format check
|
2026-09-19 12:43:21 +02:00
|
|
|
run: |
|
|
|
|
|
. .venv/bin/activate
|
|
|
|
|
ruff format --check .
|
2026-09-19 12:11:06 +02:00
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
2026-09-19 12:43:21 +02:00
|
|
|
- name: Checkout
|
|
|
|
|
run: |
|
2026-09-19 15:34:42 +02:00
|
|
|
git clone https://omegakubeserv.tail951d2f.ts.net/Omega_Kube/VisionApp.git .
|
|
|
|
|
git checkout "${{ github.sha }}"
|
2026-09-19 12:11:06 +02:00
|
|
|
|
2026-09-19 12:43:21 +02:00
|
|
|
- name: Setup Python
|
|
|
|
|
run: |
|
|
|
|
|
apt-get update && apt-get install -y python3 python3-pip python3-venv
|
|
|
|
|
python3 -m venv .venv
|
|
|
|
|
. .venv/bin/activate
|
|
|
|
|
pip install -r requirements.txt -r requirements-dev.txt
|
2026-09-19 12:11:06 +02:00
|
|
|
|
|
|
|
|
- name: Syntax check
|
2026-09-19 12:31:30 +02:00
|
|
|
run: |
|
2026-09-19 12:43:21 +02:00
|
|
|
. .venv/bin/activate
|
|
|
|
|
python3 -m py_compile bot.py
|
|
|
|
|
python3 -m py_compile vision.py
|
|
|
|
|
python3 -m py_compile config.py
|
2026-09-19 12:11:06 +02:00
|
|
|
|
|
|
|
|
- name: Run tests
|
2026-09-19 12:43:21 +02:00
|
|
|
run: |
|
|
|
|
|
. .venv/bin/activate
|
|
|
|
|
pytest tests/ -v || true
|
2026-09-19 12:31:30 +02:00
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
|
needs: [lint, test]
|
|
|
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
2026-09-19 12:43:21 +02:00
|
|
|
- name: Deploy to production
|
|
|
|
|
run: |
|
|
|
|
|
apt-get update && apt-get install -y sshpass openssh-client
|
2026-09-19 15:34:42 +02:00
|
|
|
sshpass -p "${{ secrets.PROD_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} "cd /home/discord/Bots/VisionApp && git pull origin main --rebase && source venv/bin/activate && pip install -r requirements.txt && echo '${{ secrets.PROD_PASSWORD }}' | sudo -S systemctl restart vision-studio && echo 'Deploy OK'"
|