All checks were successful
CI/CD / lint (push) Successful in 41s
CI/CD / test (push) Successful in 44s
CI/CD / lint (pull_request) Successful in 44s
CI/CD / test (pull_request) Successful in 45s
CI/CD / deploy (push) Has been skipped
CI/CD / deploy (pull_request) Has been skipped
- git clone defaulted to main, so dev pushes were tested against main - Now clone + git checkout github.sha - Deploy: restart service via sudo -S with secret password
70 lines
2.1 KiB
YAML
70 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 https://omegakubeserv.tail951d2f.ts.net/Omega_Kube/VisionApp.git .
|
|
git checkout "${{ github.sha }}"
|
|
|
|
- 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 https://omegakubeserv.tail951d2f.ts.net/Omega_Kube/VisionApp.git .
|
|
git checkout "${{ github.sha }}"
|
|
|
|
- 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 }} "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'"
|