VisionApp/.forgejo/workflows/ci.yml
Mathis f0e93d6262
Some checks failed
CI/CD / lint (push) Failing after 49s
CI/CD / test (push) Successful in 47s
CI/CD / deploy (push) Has been skipped
fix(ci): rewrite workflow without data.forgejo.org proxy
- Replace actions/checkout with direct git clone from Forgejo
- Replace actions/setup-python with apt install python3
- Use sshpass for deploy instead of appleboy/ssh-action
- Compatible with self-hosted Forgejo runners
2026-09-19 12:43:21 +02:00

76 lines
2.1 KiB
YAML

name: CI/CD
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
git clone --depth 1 https://omegakubeserv.tail951d2f.ts.net/Omega_Kube/VisionApp.git .
git fetch --all
- 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
- name: Ruff lint
run: |
. .venv/bin/activate
ruff check .
- name: Ruff format check
run: |
. .venv/bin/activate
ruff format --check .
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
git clone --depth 1 https://omegakubeserv.tail951d2f.ts.net/Omega_Kube/VisionApp.git .
- 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
- name: Syntax check
run: |
. .venv/bin/activate
python3 -m py_compile bot.py
python3 -m py_compile vision.py
python3 -m py_compile config.py
- name: Run tests
run: |
. .venv/bin/activate
pytest tests/ -v || true
deploy:
needs: [lint, test]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Deploy to production
run: |
apt-get update && apt-get install -y sshpass openssh-client
sshpass -p "${{ secrets.PROD_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} << 'DEPLOY'
cd /home/discord/Bots/VisionApp
git pull origin main --rebase
source venv/bin/activate
pip install -r requirements.txt
sudo systemctl restart vision-studio
echo "Deploy OK"
DEPLOY